/* PATS - UI copied from SKU HUB (MIEDECO). Light + dark, responsive. PATS-specific additions are at the end. */
: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-body { 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; }


.flex-none { flex: none; }
@media (min-width: 1400px) { .d-xxl-table-cell { display: table-cell !important; } .d-xxl-inline { display: inline !important; } }

/* 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); }


/* 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); }

/* saved filter views */
.sv-menu .sv-del{padding:.25rem .6rem}

/* ===== 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; }
}

/* ---- SALES OUT Analysis (v1.5.0) ---- */
.mv-stat { border-left-width: 4px; }
.mv-stat.mv-fast { border-left-color: #1f9d55; } .mv-stat.mv-slow { border-left-color: #e0a100; } .mv-stat.mv-non { border-left-color: #d64545; } .mv-stat.mv-nodata { border-left-color: #8a98a0; }
.mv-badge { font-weight: 600; letter-spacing: .01em; }
.mv-donut { width: 100%; height: auto; } .mv-donut-n { font-size: 26px; font-weight: 750; fill: var(--sh-text); } .mv-donut-l { font-size: 10px; fill: var(--sh-muted); }
.mv-legend li { display: flex; align-items: center; gap: .4rem; margin-bottom: .35rem; } .mv-dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.mv-hbars { display: grid; gap: .45rem; } .mv-hb { display: grid; grid-template-columns: minmax(70px, 34%) 1fr auto; gap: .5rem; align-items: center; font-size: .78rem; }
.mv-hb-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .mv-hb-t { height: 10px; border-radius: 6px; background: var(--sh-border); overflow: hidden; } .mv-hb-t span { display: block; height: 100%; border-radius: 6px; } .mv-hb-v { font-variant-numeric: tabular-nums; font-weight: 600; }
.mv-trend { width: 100%; height: auto; } .mv-t-v { font-size: 10px; fill: var(--sh-text); } .mv-t-l { font-size: 10px; fill: var(--sh-muted); }
.mv-tabs .nav-link { color: var(--sh-text); border: 1px solid var(--sh-border); margin-right: .35rem; background: var(--sh-card); }
.mv-tabs .nav-link.active { color: #fff; } .mv-tabs .mv-tab-fast.active { background: #1f9d55; } .mv-tabs .mv-tab-slow.active { background: #b88300; } .mv-tabs .mv-tab-non.active { background: #d64545; } .mv-tabs .mv-tab-nodata.active { background: #6c7a82; }
.mv-table td.clip2, td.clip2 { max-width: 340px; overflow-wrap: anywhere; }
.mv-table td.sku, td.sku { font-family: ui-monospace, Consolas, monospace; font-weight: 700; white-space: nowrap; }
@media (max-width: 575.98px) { .mv-hb { grid-template-columns: minmax(60px, 38%) 1fr auto; } }

/* SALES OUT layout fixes: readable description column, scroll instead of squeeze, tighter result table */
.mv-mini { min-width: 480px; } .mv-mini td:nth-child(2), .mv-mini th:nth-child(2) { min-width: 150px; }
.mv-table th, .mv-table td { padding-left: .5rem; padding-right: .5rem; }
.mv-table td:nth-child(2) { min-width: 190px; } .mv-table td:nth-child(4) { max-width: 150px; font-size: .85em; }
.mv-table th { white-space: nowrap; }
@media (max-width: 767.98px) { .mv-tabs .nav-link { padding: .35rem .6rem; font-size: .85rem; } }
@media (max-width: 1499.98px) { .mv-items-fast th:nth-child(4), .mv-items-fast td:nth-child(4) { display: none; } }

/* v2.1.0 RDU: long sidebar labels (e.g. "Goods Receiving & Inspection (GRI)") wrap instead of being cut off */
.sidebar .nav-link { white-space: normal; line-height: 1.25; }
.sidebar .nav-link span { min-width: 0; }
.in-sections { flex-wrap: wrap; gap: .15rem .35rem; }
/* GRI batch progress tracker */
.in-steps { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; }
.in-steps li { display: flex; align-items: center; gap: .45rem; color: var(--bs-secondary-color); font-size: .85rem; }
.in-steps li + li::before { content: ""; width: 1.6rem; height: 2px; background: var(--bs-border-color); margin-right: .55rem; }
.in-steps .dot { width: 1.5rem; height: 1.5rem; border-radius: 50%; display: inline-grid; place-items: center; font-size: .72rem; font-weight: 700; background: var(--bs-secondary-bg); border: 1px solid var(--bs-border-color); }
.in-steps li.done { color: var(--bs-success); } .in-steps li.done .dot { background: var(--bs-success); border-color: var(--bs-success); color: #fff; }
.in-steps li.now { color: var(--bs-body-color); font-weight: 700; } .in-steps li.now .dot { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; }
@media (max-width: 575px) { .in-steps li + li::before { display: none; } }

/* =====================================================================================================
   v2.2 UI/UX design layer (appearance only). One system for every module: header, sidebar, buttons,
   tables, cards, badges, module navigation, page heading, filter panels. Light and dark.
   ===================================================================================================== */
:root {
  --sh-side-w: 244px; --sh-radius: 12px; --sh-th-bg: #eef3f0; --sh-row-hover: rgba(11,122,75,.05);
  --sh-shadow: 0 1px 2px rgba(16,40,28,.05), 0 1px 3px rgba(16,40,28,.04);
  --sh-soft-yellow: #fff6d6; --sh-light-green: #e8f6ee; --sh-ctl-h: 36px; --sh-ctl-h-sm: 30px;
}
[data-bs-theme="dark"] { --sh-th-bg: #1b281f; --sh-row-hover: rgba(67,184,123,.08); --sh-shadow: 0 1px 2px rgba(0,0,0,.35); --sh-soft-yellow: #3a3112; --sh-light-green: #17402b; }
body { font-size: .9rem; line-height: 1.45; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5 { letter-spacing: -.01em; }
.content { padding: 1.1rem 1.25rem 2.5rem; max-width: 1760px; width: 100%; margin-inline: auto; }
.card { border-radius: var(--sh-radius); box-shadow: var(--sh-shadow); }
.card-header { padding: .7rem 1rem; font-size: .9rem; }
.card-footer { background: transparent; border-top: 1px solid var(--sh-border); padding: .6rem 1rem; font-size: .82rem; color: var(--sh-muted); }

/* ---------- sidebar ---------- */
.sidebar { background: linear-gradient(180deg, #06452a 0%, #053b24 100%); box-shadow: 1px 0 0 rgba(0,0,0,.08); }
[data-bs-theme="dark"] .sidebar { background: #04301d; }
.sidebar .brand { padding: .85rem 1rem; min-height: 64px; gap: .65rem; }
.sidebar .brand img { height: 38px; width: 38px; border-radius: 9px; }
.sidebar .brand-text b { font-size: .98rem; letter-spacing: .02em; }
.sidebar .brand-text small { font-size: .7rem; letter-spacing: .03em; }
.sidebar nav { padding: .25rem .5rem 1rem; }
.nav-section { padding: .85rem .6rem .3rem; font-size: .66rem; font-weight: 700; letter-spacing: .1em; opacity: .6; }
.nav-group[data-group="rdu"] .nav-section { opacity: .95; color: #f6dc7a; }
.sidebar .nav-link { padding: .45rem .65rem; margin: 1px 0; gap: .65rem; font-size: .86rem; border-left: 0; border-radius: 8px; line-height: 1.25; position: relative; }
.sidebar .nav-link i { width: 1.1rem; font-size: .9rem; opacity: .85; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.07); }
.sidebar .nav-link.active { background: rgba(125,225,170,.17); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #7de1aa; }
.sidebar .nav-link.active i { opacity: 1; color: #9cf0c2; }
.sidebar .side-foot { padding: .5rem 1rem; }
@media (min-width: 992px) {
  body.sidebar-collapsed .sidebar nav { padding-inline: .35rem; }
  body.sidebar-collapsed .sidebar .nav-link { padding: .6rem 0; }
  body.sidebar-collapsed .sidebar .nav-link.active { box-shadow: none; }
}

/* ---------- top bar: [toggle + title] [ search ] [ clock · new · theme · user ] ---------- */
.topbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 360px) auto; align-items: center; gap: .75rem; padding: .5rem 1.1rem; min-height: 56px; box-shadow: var(--sh-shadow); }
.topbar-left { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.topbar .page-title { font-size: 1.02rem; flex: 0 1 auto; min-width: 0; }
.topbar-center { min-width: 0; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; min-width: 0; }
.gsearch { width: 100%; }
.gsearch .gs-field { position: relative; }
.gsearch .gs-field > i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--sh-muted); font-size: .8rem; pointer-events: none; }
.gsearch input { width: 100% !important; height: var(--sh-ctl-h); padding-left: 2.1rem; border-radius: 999px; background: var(--sh-bg); border-color: var(--sh-border); font-size: .85rem; }
.gsearch input:focus { background: var(--sh-card); }
.topbar .clock { font-size: .78rem; line-height: 1.15; text-align: right; }
.topbar .btn { height: var(--sh-ctl-h); }
.topbar .btn-icon { width: var(--sh-ctl-h); padding: 0; justify-content: center; }
.topbar-right .btn-primary { white-space: nowrap; }
@media (min-width: 1500px) { .topbar { grid-template-columns: minmax(0, 1fr) minmax(240px, 480px) auto; } }
@media (max-width: 1499.98px) { .topbar .clock { display: none; } }
@media (max-width: 1279.98px) { .topbar-right .u-name { display: none; } }
@media (max-width: 991.98px) { .topbar { grid-template-columns: minmax(0, auto) minmax(120px, 1fr) auto; } .topbar-right .nb-label { display: none; } .topbar-right .btn-primary { width: var(--sh-ctl-h); padding: 0; justify-content: center; } }
@media (max-width: 767.98px) {
  .topbar { grid-template-columns: minmax(0, 1fr) auto; padding: .45rem .7rem; row-gap: .4rem; }
  .topbar-center { grid-column: 1 / -1; grid-row: 2; }
  .topbar .page-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.2; }
  .page-head-actions > .btn-primary { order: -2; } .page-head-actions > .btn-outline-primary { order: -1; }
  .topbar-right { gap: .35rem; }
  .topbar .page-title { font-size: .95rem; }
  .topbar-right .u-name { display: none; }
}

/* ---------- buttons: one height, one icon size, clear roles ---------- */
.btn { --bs-btn-padding-y: .4rem; --bs-btn-padding-x: .85rem; --bs-btn-font-size: .85rem; --bs-btn-font-weight: 600; --bs-btn-border-radius: .55rem; min-height: var(--sh-ctl-h); display: inline-flex; align-items: center; justify-content: center; gap: .4rem; line-height: 1.2; }
.btn-sm { --bs-btn-padding-y: .25rem; --bs-btn-padding-x: .65rem; --bs-btn-font-size: .8rem; min-height: var(--sh-ctl-h-sm); }
.btn > i, .btn > .fa-solid { font-size: .85em; margin: 0 !important; width: auto; }
.btn .me-1, .btn .me-2, .btn .ms-1 { margin: 0 !important; }
.btn-lg { min-height: 44px; }
.btn-primary { box-shadow: 0 1px 2px rgba(11,122,75,.25); }
.btn-light, .btn-outline-secondary { --bs-btn-bg: var(--sh-card); --bs-btn-color: var(--sh-text); --bs-btn-border-color: var(--sh-border); --bs-btn-hover-bg: var(--sh-bg); --bs-btn-hover-color: var(--sh-text); --bs-btn-hover-border-color: #b9c8bf;
  --bs-btn-active-bg: var(--sh-bg); --bs-btn-active-color: var(--sh-text); --bs-btn-active-border-color: #b9c8bf; --bs-btn-disabled-bg: var(--sh-card); --bs-btn-disabled-color: var(--sh-muted); --bs-btn-disabled-border-color: var(--sh-border); }
.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-hover-color: #fff; --bs-btn-active-bg: var(--sh-primary-dark); --bs-btn-active-border-color: var(--sh-primary-dark); }
.btn-info, .btn-outline-info { --bs-btn-color: #1d5fa8; --bs-btn-bg: #e6f0fb; --bs-btn-border-color: #bcd6f3; --bs-btn-hover-bg: #d6e7fa; --bs-btn-hover-color: #174d8a; --bs-btn-hover-border-color: #9fc4ee; --bs-btn-active-bg: #d6e7fa; --bs-btn-active-color: #174d8a; }
[data-bs-theme="dark"] .btn-info, [data-bs-theme="dark"] .btn-outline-info { --bs-btn-color: #8fc2f5; --bs-btn-bg: #172f4a; --bs-btn-border-color: #24476d; --bs-btn-hover-bg: #1d3b5d; --bs-btn-hover-color: #b6d8fa; }
.btn-danger { --bs-btn-bg: #c0392b; --bs-btn-border-color: #c0392b; --bs-btn-hover-bg: #a52f23; --bs-btn-hover-border-color: #a52f23; --bs-btn-active-bg: #a52f23; }
.btn-outline-danger { --bs-btn-color: #c0392b; --bs-btn-border-color: #e3b3ad; --bs-btn-hover-bg: #c0392b; --bs-btn-hover-border-color: #c0392b; }
[data-bs-theme="dark"] .btn-light, [data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-bg: #172119; --bs-btn-hover-bg: #1e2b21; --bs-btn-hover-border-color: #3a5143; --bs-btn-active-bg: #1e2b21; --bs-btn-disabled-bg: #172119; }
.btn-light.border { border-color: var(--sh-border) !important; }
.btn-group .btn { min-height: var(--sh-ctl-h); }
.btn-group-sm .btn { min-height: var(--sh-ctl-h-sm); }
.btn-icon-only { width: var(--sh-ctl-h-sm); padding: 0; }
.form-control, .form-select { min-height: var(--sh-ctl-h); font-size: .88rem; border-radius: .55rem; border-color: var(--sh-border); }
.form-control-sm, .form-select-sm { min-height: var(--sh-ctl-h-sm); font-size: .82rem; }
textarea.form-control { min-height: 0; }
.ts-control { min-height: var(--sh-ctl-h); }
.form-label { color: var(--sh-muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.modal .form-label, .offcanvas .form-label { text-transform: none; letter-spacing: 0; font-size: .84rem; color: var(--sh-text); font-weight: 600; }
.modal-content { border-radius: 14px; border-color: var(--sh-border); box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.modal-header { border-bottom-color: var(--sh-border); padding: .85rem 1.15rem; } .modal-header .modal-title { font-size: 1.02rem; font-weight: 700; }
.modal-footer { border-top-color: var(--sh-border); padding: .75rem 1.15rem; gap: .5rem; }
.dropdown-menu { border-color: var(--sh-border); border-radius: .7rem; box-shadow: 0 10px 30px rgba(16,40,28,.14); padding: .35rem; font-size: .86rem; }
.dropdown-item { border-radius: .45rem; padding: .4rem .65rem; }
.dropdown-item:active { background: var(--sh-primary); }
.dropdown-header { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; }

/* ---------- status badges: soft, readable, one shape ---------- */
.badge { font-weight: 650; font-size: .72rem; letter-spacing: .01em; padding: .32em .62em; border-radius: 999px; white-space: nowrap; }
.badge.text-bg-success { background: #dcf3e6 !important; color: #0b5d3b !important; }
.badge.text-bg-warning { background: #fdf0c4 !important; color: #7a5600 !important; }
.badge.text-bg-danger { background: #fbe0de !important; color: #a3231b !important; }
.badge.text-bg-info { background: #dcebfb !important; color: #174d8a !important; }
.badge.text-bg-primary { background: #d3efe0 !important; color: #0b5d3b !important; }
.badge.text-bg-secondary, .badge.text-bg-light { background: #e8ecea !important; color: #44564d !important; }
.badge.text-bg-dark { background: #dfe7e3 !important; color: #1c2622 !important; border: 1px solid #c3d0c9; }
[data-bs-theme="dark"] .badge.text-bg-success { background: #17402b !important; color: #7ad6a2 !important; }
[data-bs-theme="dark"] .badge.text-bg-warning { background: #45340f !important; color: #f4c460 !important; }
[data-bs-theme="dark"] .badge.text-bg-danger { background: #4a1f1c !important; color: #ff9d96 !important; }
[data-bs-theme="dark"] .badge.text-bg-info { background: #172f4a !important; color: #9ccbf7 !important; }
[data-bs-theme="dark"] .badge.text-bg-primary { background: #17402b !important; color: #7ad6a2 !important; }
[data-bs-theme="dark"] .badge.text-bg-secondary, [data-bs-theme="dark"] .badge.text-bg-light { background: #25302a !important; color: #b7c6bd !important; }
[data-bs-theme="dark"] .badge.text-bg-dark { background: #25302a !important; color: #e3ece7 !important; border-color: #3a4a40; }

/* ---------- tables: one design everywhere ---------- */
.table { font-size: .86rem; }
.table > :not(caption) > * > * { padding: .6rem .8rem; }
.table thead th { background: var(--sh-th-bg); font-size: .69rem; letter-spacing: .06em; color: var(--sh-muted); border-bottom: 1px solid var(--sh-border); padding-top: .55rem; padding-bottom: .55rem; }
.table tbody tr:last-child > * { border-bottom-width: 0; }
.table-hover > tbody > tr:hover > * { --bs-table-hover-bg: var(--sh-row-hover); }
.table td.text-end, .table th.text-end { font-variant-numeric: tabular-nums; }
.table td .small, .table td small { color: var(--sh-muted); }
.table-wrap { max-height: calc(100vh - 300px); min-height: 80px; overflow: auto; border-radius: 0 0 var(--sh-radius) var(--sh-radius); }
.table-wrap thead th { position: sticky; top: 0; z-index: 3; box-shadow: 0 1px 0 var(--sh-border); background: var(--sh-th-bg); }
[data-table] .table thead th { background: var(--sh-th-bg); }
[data-table] .table-wrap { max-height: calc(100vh - 280px); }
.card > .table-wrap:first-child, .card > .table-responsive:first-child { border-radius: var(--sh-radius) var(--sh-radius) 0 0; }
.table-wrap .table { margin-bottom: 0; }
.table .btn-sm { min-height: 28px; --bs-btn-padding-x: .55rem; }
.table td.actions, .table td:last-child > .btn-sm:only-child { white-space: nowrap; }
.empty-state { padding: 2.2rem 1rem; font-size: .88rem; }
.empty-state i { font-size: 1.8rem; color: var(--sh-primary); opacity: .35; }
body.sidebar-collapsed [data-table] .table-wrap { max-height: calc(100vh - 280px); }
.table-loading .spinner-border { color: var(--sh-primary); }
.pagination { --bs-pagination-font-size: .8rem; --bs-pagination-padding-x: .6rem; --bs-pagination-padding-y: .25rem; --bs-pagination-active-bg: var(--sh-primary); --bs-pagination-active-border-color: var(--sh-primary); --bs-pagination-color: var(--sh-text); --bs-pagination-bg: var(--sh-card); --bs-pagination-border-color: var(--sh-border); --bs-pagination-hover-bg: var(--sh-bg); --bs-pagination-disabled-bg: var(--sh-card); --bs-pagination-hover-color: var(--sh-primary); --bs-pagination-border-radius: .45rem; }
.pagination .page-link { min-width: 32px; text-align: center; }

/* ---------- reusable: page heading ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: .75rem 1.25rem; flex-wrap: wrap; margin: 0 0 .9rem; }
.page-head-text { min-width: 0; flex: 1 1 320px; }
.page-head-title { font-size: 1.3rem; font-weight: 750; margin: 0; display: flex; align-items: center; gap: .55rem; line-height: 1.2; }
.page-head-title i { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px; background: var(--sh-light-green); color: var(--sh-primary); font-size: .95rem; flex: none; }
.page-head-sub { margin: .3rem 0 0; color: var(--sh-muted); font-size: .85rem; max-width: 78ch; }
.page-head-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.page-head-actions .btn-group-sep { width: 1px; height: 22px; background: var(--sh-border); margin: 0 .15rem; }
@media (max-width: 767.98px) { .page-head { align-items: stretch; } .page-head-title { font-size: 1.12rem; } .page-head-actions { width: 100%; } .page-head-actions > .btn-primary, .page-head-actions > .btn-outline-primary { flex: 1 1 auto; } .page-head-actions .btn-group-sep { display: none; } }

/* ---------- reusable: summary cards ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
@media (min-width: 1100px) { .kpis.k5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } .kpis.k6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (min-width: 576px) and (max-width: 1099.98px) { .kpis.k5, .kpis.k6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpi { display: flex; align-items: center; gap: .8rem; padding: .8rem .95rem; min-height: 76px; background: var(--sh-card); border: 1px solid var(--sh-border); border-radius: var(--sh-radius); box-shadow: var(--sh-shadow); min-width: 0; }
.kpi-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1rem; flex: none; }
.kpi-body { min-width: 0; }
.kpi-num { font-size: 1.4rem; font-weight: 750; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-lbl { font-size: .74rem; color: var(--sh-muted); margin-top: .22rem; line-height: 1.25; overflow-wrap: anywhere; }
@media (max-width: 575.98px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; } .kpi { padding: .65rem .65rem; gap: .55rem; min-height: 66px; } .kpi-ico { width: 32px; height: 32px; font-size: .85rem; border-radius: 8px; } .kpi-num { font-size: 1.15rem; } .kpi-lbl { font-size: .68rem; } }
.stat { border-left-width: 1px; border-radius: var(--sh-radius); box-shadow: var(--sh-shadow); }
.stat .num { font-size: 1.4rem; }

/* ---------- reusable: filter panel ---------- */
.filter-panel { margin-bottom: .9rem; }
.filter-panel .card-body { padding: .8rem 1rem; }
.filter-panel .fp-bar { display: flex; justify-content: space-between; align-items: center; gap: .6rem 1rem; flex-wrap: wrap; margin-top: .75rem; }
.filter-panel .fp-bar .fp-quick { margin-top: 0; }
.filter-panel .fp-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filter-panel .fp-more { padding-top: .75rem; margin-top: .75rem; border-top: 1px dashed var(--sh-border); }
.filter-panel .fp-quick { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .65rem; font-size: .8rem; }
.filter-panel .fp-quick .btn { --bs-btn-padding-x: .6rem; min-height: 26px; --bs-btn-font-size: .76rem; border-radius: 999px; }
@media (max-width: 767.98px) { .filter-panel .fp-actions { width: 100%; } .filter-panel .fp-actions .btn { flex: 1 1 auto; } }

/* table card header (count + tools) */
.card-header.tbl-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; font-weight: 650; }

/* ---------- numeric columns & inventory table ---------- */
.tbl-num td, .tbl-num th { font-variant-numeric: tabular-nums; }
.tbl-inv .col-sku { white-space: nowrap; }
.tbl-inv > :not(caption) > * > * { padding: .55rem .55rem; }
.tbl-inv thead th { white-space: normal; line-height: 1.15; vertical-align: bottom; }
.tbl-inv td.num-strong { font-weight: 700; }
.tbl-inv td.zero { color: var(--sh-muted); }

/* ---------- responsive content padding ---------- */
@media (max-width: 767.98px) { .content { padding: .8rem .7rem 2.5rem; } .table-wrap { max-height: none; } .card-header, .card-footer { padding-inline: .8rem; } }
@media (max-width: 991.98px) { .content { padding-inline: .9rem; } }
.stat { padding: .8rem .95rem; min-height: 76px; gap: .8rem; }
.stat .ico { width: 40px; height: 40px; font-size: 1rem; border-radius: 10px; }
.stat .lbl { font-size: .74rem; }
/* one green primary: legacy success buttons share the primary look */
.btn-success { --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); box-shadow: 0 1px 2px rgba(11,122,75,.25); }
[data-bs-theme="dark"] .btn-success { --bs-btn-color: #04150c; --bs-btn-hover-color: #04150c; --bs-btn-active-color: #04150c; }
@media (max-width: 575.98px) { .card-body form.row > .col-md-auto .btn, .filter-panel .fp-actions .btn { flex: 1 1 auto; } }

/* dropdowns open over the sidebar-free content area, never clipped under it */
.dropdown-menu { z-index: 1060; max-height: 70vh; overflow-y: auto; }
.page-head-actions .dropdown-menu { min-width: 260px; }

/* ---------- RDU nested sidebar (GRI, SIT): expandable modules with grouped sub-menus (markup: views/partials/sidebar_rdu.php) ---------- */
.sidebar .nav-parent { width: 100%; background: none; border: 0; text-align: left; font-family: inherit; font-size: .9rem; font-weight: 700; color: #fff; cursor: pointer; }
.sidebar .nav-parent > span { flex: 1 1 auto; min-width: 0; }
.sidebar .nav-parent .nav-caret { flex: none; width: auto; margin-left: auto; font-size: .62rem; opacity: .65; transition: transform .2s ease; }
.nav-module:not(.open) .nav-caret { transform: rotate(-90deg); }
.sidebar .nav-parent:hover { background: rgba(255,255,255,.08); }
.sidebar .nav-parent.active { background: rgba(255,255,255,.07); box-shadow: inset 3px 0 0 rgba(125,225,170,.55); }
.sidebar .nav-parent.active i:first-child { opacity: 1; color: #9cf0c2; }
.nav-sub { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows .22s ease, visibility 0s linear .22s; }
.nav-module.open > .nav-sub { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .22s ease, visibility 0s; }
.nav-sub-inner { overflow: hidden; min-height: 0; }
.nav-sub-group { margin: 0 0 0 1.05rem; padding: 0 0 .3rem .35rem; border-left: 1px solid rgba(255,255,255,.14); }
.nav-sub-inner > .nav-sub-group:first-child { margin-top: .15rem; }
.nav-sub-label { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--sh-side-text); opacity: .55; padding: .5rem .6rem .15rem; }
.sidebar .nav-sublink { font-size: .83rem; padding: .38rem .6rem; gap: .55rem; }
.sidebar .nav-sublink i { width: 1rem; font-size: .8rem; }
.sidebar .nav-sublink.active { background: rgba(125,225,170,.2); box-shadow: inset 3px 0 0 #7de1aa; }
@media (min-width: 992px) {
  body.sidebar-collapsed .nav-parent .nav-caret, body.sidebar-collapsed .nav-sub-label { display: none; }
  body.sidebar-collapsed .nav-sub-group { margin: 0; padding: .25rem 0 0; border-left: 0; }
  body.sidebar-collapsed .nav-sub-group + .nav-sub-group { margin-top: .25rem; border-top: 1px solid rgba(255,255,255,.1); }
  body.sidebar-collapsed .sidebar .nav-sublink { padding: .5rem 0; }
}
@media (max-width: 991.98px) {
  .sidebar { max-width: 88vw; }
  .sidebar nav { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .sidebar .nav-sublink { padding: .5rem .6rem; }
}
@media (prefers-reduced-motion: reduce) { .nav-sub, .nav-module.open > .nav-sub, .sidebar .nav-parent .nav-caret { transition: none; } }

/* ===== v2.3.0 GRI / SIT: table-first pages, compact KPI strip, vertical action rail =================================== */
.rdu-shell { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: .9rem; align-items: start; }
.rdu-main { min-width: 0; }
.rdu-rail { position: sticky; top: 68px; z-index: 20; max-height: calc(100vh - 84px); }
.rdu-rail .rail-body { display: flex; flex-direction: column; gap: .15rem; padding: .35rem .25rem; background: var(--sh-card); border: 1px solid var(--sh-border); border-radius: var(--sh-radius); box-shadow: var(--sh-shadow); max-height: calc(100vh - 84px); overflow-y: auto; scrollbar-width: thin; }
.rdu-rail .rail-fab { display: none; }
.rail-group + .rail-group { margin-top: .3rem; padding-top: .3rem; border-top: 1px solid var(--sh-border); }
.rail-gl { font-size: .54rem; letter-spacing: .06em; text-transform: uppercase; color: var(--bs-secondary-color); text-align: center; padding: .1rem 0 .15rem; }
.rail-btn { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .35rem .15rem; border-radius: 12px; color: var(--bs-body-color); text-decoration: none; text-align: center; line-height: 1.1; min-height: 48px; justify-content: center; }
.rail-btn i { font-size: 1.05rem; width: 36px; height: 26px; display: grid; place-items: center; border-radius: 13px; transition: background .15s; }
.rail-btn span { font-size: .62rem; font-weight: 500; max-width: 70px; overflow-wrap: anywhere; }
.rail-btn:hover i { background: var(--sh-row-hover, rgba(25,135,84,.1)); }
.rail-btn.active i { background: var(--sh-light-green, #d8f0e2); color: var(--bs-success-text-emphasis, #0f5132); }
.rail-btn.active span { font-weight: 700; }
.rail-btn:focus-visible { outline: 2px solid var(--bs-success); outline-offset: 1px; }
@media (max-width: 991.98px) {
  .rdu-shell { grid-template-columns: minmax(0, 1fr); }
  .rdu-rail { position: static; max-height: none; }
  .rdu-rail .rail-fab { display: inline-flex; position: fixed; right: 14px; bottom: 16px; z-index: 1045; align-items: center; gap: .45rem; padding: .6rem .9rem; border: 0; border-radius: 28px; background: var(--bs-success); color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.28); min-height: 44px; font-weight: 600; }
  .rdu-rail .rail-body { display: none; position: fixed; right: 14px; bottom: 70px; z-index: 1044; width: min(310px, calc(100vw - 28px)); max-height: 70vh; flex-direction: row; flex-wrap: wrap; gap: .1rem; padding: .6rem; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
  .rdu-rail.open .rail-body { display: flex; }
  .rail-group { width: 100%; display: flex; flex-wrap: wrap; }
  .rail-group + .rail-group { margin-top: .2rem; }
  .rail-gl { width: 100%; text-align: left; padding-left: .3rem; }
  .rail-btn { width: 25%; min-height: 56px; }
}
/* compact KPI strip: one slim row of small figures instead of large cards */
.kpis.kpis-compact { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.kpis-compact .kpi { min-height: 0; padding: .3rem .6rem; gap: .45rem; flex: 1 1 108px; max-width: 190px; box-shadow: none; }
.kpis-compact .kpi-ico { width: 24px; height: 24px; font-size: .7rem; border-radius: 7px; }
.kpis-compact .kpi-num { font-size: 1rem; line-height: 1.1; }
.kpis-compact .kpi-lbl { font-size: .66rem; }
.in-scan-card .card-body { padding: .6rem .8rem; }
.inv-table thead th { position: sticky; top: 0; z-index: 2; background: var(--sh-th-bg, var(--sh-card)); white-space: nowrap; }
.inv-table { min-width: 1080px; }
body > .ts-dropdown { z-index: 1090; }

/* =====================================================================
   PATS additions on top of the SKU HUB UI
   ===================================================================== */
:root { --p: var(--sh-primary); --pd: var(--sh-primary-dark); --ps: var(--sh-primary-soft); --ac: var(--sh-accent); --bd: var(--sh-border); --mut: var(--sh-muted); --card: var(--sh-card); --bg: var(--sh-bg); }
html, body { max-width: 100%; overflow-x: hidden; }
.card, [class*=col-] { min-width: 0; }
.btn-accent { background: var(--sh-accent); border-color: var(--sh-accent); color: #2b2200; font-weight: 600; }
.btn-accent:hover { background: #c99700; border-color: #c99700; color: #2b2200; }
.tag { font-family: ui-monospace, Menlo, Consolas, monospace; }
.page-head h1 { font-size: 1.3rem; font-weight: 750; margin: 0; line-height: 1.2; }
.page-head .sub { margin: .3rem 0 0; color: var(--sh-muted); font-size: .85rem; max-width: 78ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
/* KPI cards */
.kpi { background: var(--sh-card); border: 1px solid var(--sh-border); border-radius: var(--sh-radius); padding: .85rem 1rem; height: 100%; border-left: 4px solid var(--sh-primary); }
.kpi .n { font-size: 1.5rem; font-weight: 750; line-height: 1.1; } .kpi .l { color: var(--sh-muted); font-size: .78rem; }
.kpi.warn { border-left-color: var(--sh-accent); } .kpi.bad { border-left-color: #c0392b; } .kpi.money .n { font-size: 1.2rem; }
.kv dt { color: var(--sh-muted); font-weight: 500; padding: .25rem 0; } .kv dd { padding: .25rem 0; margin: 0; word-break: break-word; }
.bare { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(135deg, #064e2f, #0b7a4b); }
.login-card { width: min(420px, 92vw); }
.scan-box { border: 2px dashed var(--sh-primary); border-radius: 14px; padding: 1rem; background: var(--sh-primary-soft); }
.js-qr svg { width: 100%; height: 100% !important; }
.bc { max-width: 100%; height: auto; display: block; }
.card-body svg:not(.bc):not(.keep) { max-width: 100%; height: auto; }
.invalid-feedback:empty { display: none; }
.notif-badge { position: absolute; top: -6px; right: -6px; font-size: .6rem; } .notif-menu { min-width: 300px; max-width: 360px; }
/* status colours: green ok, yellow pending, blue assigned/in-progress, orange attention, red bad, gray archived */
.badge.bg-ok { background: #198754 !important; color: #fff; } .badge.bg-pend { background: #f2b705 !important; color: #2b2200 !important; } .badge.bg-prog { background: #0d6efd !important; color: #fff; }
.badge.bg-attn { background: #fd7e14 !important; color: #fff; } .badge.bg-bad { background: #dc3545 !important; color: #fff; } .badge.bg-arch { background: #6c757d !important; color: #fff; }
/* clickable rows, manage menu, filters */
tr[data-href], tr[data-row-modal] { cursor: pointer; }
tr[data-href]:focus-visible, tr[data-row-modal]:focus-visible { outline: 2px solid var(--sh-accent); outline-offset: -2px; }
tr.row-void > td { opacity: .6; text-decoration: line-through; }
.col-act { width: 1%; white-space: nowrap; text-align: right; }
.act-btn { --bs-btn-padding-y: .15rem; --bs-btn-padding-x: .55rem; }
.dropdown-menu .dropdown-item i { width: 1.25rem; text-align: center; color: var(--sh-muted); } .dropdown-menu .dropdown-item.text-danger i { color: inherit; }
.filters-more { display: none; } .filters.show-more .filters-more { display: contents; }
.list-filters .form-label { color: var(--sh-muted); font-size: .72rem; }
th.csort-asc::after { content: " \25B2"; font-size: .6rem; } th.csort-desc::after { content: " \25BC"; font-size: .6rem; }
[data-table] th:not([data-sort]):not(.col-act) { cursor: pointer; }
.page-actions .btn, .page-head-actions .btn { white-space: nowrap; }
@media (max-width: 575.98px) {
  .form-control, .form-select { font-size: 16px; }
  .page-actions { width: 100%; } .page-actions .btn, .page-actions .dropdown { flex: 1 1 calc(50% - .4rem); } .page-actions .dropdown .btn { width: 100%; }
  .topbar .page-title { display: none; } .gsearch { order: 9; flex: 1 1 100%; max-width: none; }
  .topbar { flex-wrap: wrap; }
  /* tables become cards */
  .table-stack { border-collapse: separate; border-spacing: 0 .6rem; }
  .table-stack thead { display: none; }
  .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { background: var(--sh-card); border: 1px solid var(--sh-border); border-radius: 12px; margin-bottom: .6rem; padding: .35rem .7rem; }
  .table-stack td { border: 0 !important; padding: .28rem 0 !important; display: flex; justify-content: space-between; gap: .75rem; text-align: right; background: transparent !important; }
  .table-stack td::before { content: attr(data-label); color: var(--sh-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; text-align: left; flex: 0 0 36%; padding-top: .15rem; }
  .table-stack td.col-act { justify-content: flex-end; } .table-stack td.col-act::before, .table-stack td[colspan]::before { content: none; }
}
@media (max-width: 767.98px) { .modal-dialog { margin: .5rem; } .modal-body .row > [class*=col-md], .modal-body .row > [class*=col-lg] { flex: 0 0 100%; max-width: 100%; } .kv dt { padding-bottom: 0; } .kv dd { padding-top: 0; margin-bottom: .35rem; } }

/* Modal forms: the <form> sits between .modal-content and its header/body/footer, so keep the flex chain intact => body scrolls, header/footer stay visible */
.modal-dialog-scrollable .modal-content { max-height: 100%; overflow: hidden; }
.modal-content > form { display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 1rem); overflow: hidden; }
.modal-content > form > .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-content > form > .modal-header, .modal-content > form > .modal-footer { flex: 0 0 auto; }
.modal-body .form-control, .modal-body .form-select { min-width: 0; text-overflow: ellipsis; }
.modal-body .ts-wrapper .ts-control > .item { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
