/* ==========================================================================
   Order System - UI theme (Bootstrap 5 + Plus Jakarta Sans)
   ========================================================================== */
:root {
  /* Typography pairing taken from mwianearmewata.or.tz: Karla (body) + Fraunces (display) */
  --os-font: 'Karla', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --os-font-heading: 'Fraunces', Georgia, 'Times New Roman', serif;
  --os-font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --os-scroll-thumb: #c7cedb;
  --os-scroll-thumb-hover: #94a3b8;
  --os-primary: #4f46e5;
  --os-primary-600: #4338ca;
  --os-primary-soft: #eef2ff;
  --os-bg: #f5f7fb;
  --os-surface: #ffffff;
  --os-border: #e5e7eb;
  --os-text: #0f172a;
  --os-muted: #64748b;
  --os-sidebar-bg: #0f172a;
  --os-sidebar-text: #cbd5e1;
  --os-sidebar-muted: #64748b;
  --os-sidebar-hover: rgba(255, 255, 255, .06);
  --os-sidebar-active: rgba(99, 102, 241, .22);
  --os-sidebar-w: 264px;
  --os-sidebar-w-collapsed: 78px;
  --os-topbar-h: 64px;
  --os-radius: 14px;
  --os-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);

  --bs-body-font-family: var(--os-font);
  --bs-primary: #4f46e5;
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: #4f46e5;
  --bs-link-color-rgb: 79, 70, 229;
  --bs-link-hover-color: #4338ca;
  --bs-border-color: var(--os-border);
  --bs-body-color: var(--os-text);
}

html, body { height: 100%; }
body {
  font-family: var(--os-font);
  background: var(--os-bg);
  color: var(--os-text);
  font-size: .98rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6, .page-header h1, .card-title, .topbar-title, .brand-text, .stat-value, .auth-card h1, .auth-hero h2 {
  font-family: var(--os-font-heading);
  font-weight: 500 !important;
  letter-spacing: -.015em;
  font-optical-sizing: auto;
}
.page-header h1 { font-size: 1.75rem; line-height: 1.15; }
.card-header .card-title { font-size: 1.08rem; }
.topbar-title { font-size: 1.15rem; }
.stat-value { font-size: 1.5rem; }
.btn, .form-label, .badge-soft, .nav-link, .dropdown-item { letter-spacing: .01em; }
.form-label { font-size: .86rem; }
.sidebar .nav-link { font-size: .95rem; }
.sidebar .submenu .nav-link { font-size: .9rem; }

.btn-primary {
  --bs-btn-bg: var(--os-primary); --bs-btn-border-color: var(--os-primary);
  --bs-btn-hover-bg: var(--os-primary-600); --bs-btn-hover-border-color: var(--os-primary-600);
  --bs-btn-active-bg: var(--os-primary-600); --bs-btn-disabled-bg: var(--os-primary); --bs-btn-disabled-border-color: var(--os-primary);
}
.btn-outline-primary {
  --bs-btn-color: var(--os-primary); --bs-btn-border-color: var(--os-primary);
  --bs-btn-hover-bg: var(--os-primary); --bs-btn-hover-border-color: var(--os-primary);
  --bs-btn-active-bg: var(--os-primary);
}
.btn { font-weight: 600; border-radius: 10px; }
.btn-sm { border-radius: 8px; }
.form-control, .form-select { border-radius: 10px; border-color: #d9dee7; }
.form-control:focus, .form-select:focus { border-color: #a5b4fc; box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .15); }
.form-label { font-weight: 600; font-size: .82rem; color: #334155; margin-bottom: .3rem; }
.text-muted { color: var(--os-muted) !important; }
.fw-semibold { font-weight: 600 !important; }
.small-caps { text-transform: uppercase; letter-spacing: .06em; font-size: .7rem; font-weight: 700; color: var(--os-muted); }

/* ------------------------------------------------------------------ layout */
.app { display: flex; min-height: 100vh; }
.app-main {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  margin-left: var(--os-sidebar-w); transition: margin-left .25s ease;
}
.app-content { padding: 1.5rem; flex: 1; }
.app-footer { padding: 1rem 1.5rem; color: var(--os-muted); font-size: .8rem; }

/* ----------------------------------------------------------------- sidebar */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 1040;
  width: var(--os-sidebar-w); background: var(--os-sidebar-bg); color: var(--os-sidebar-text);
  display: flex; flex-direction: column; transition: width .25s ease, transform .25s ease;
  overflow: hidden;
}
.sidebar-brand {
  height: var(--os-topbar-h); display: flex; align-items: center; gap: .75rem;
  padding: 0 1.25rem; color: #fff; text-decoration: none; flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-brand:hover { color: #fff; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; font-size: 1.1rem; overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.brand-text { font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-nav {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: .75rem .6rem 1.25rem .75rem;
  overscroll-behavior: contain; scroll-behavior: smooth;
  scrollbar-width: thin; scrollbar-color: transparent transparent; scrollbar-gutter: stable;
  /* soft fade at top & bottom edges so overflowing items fade out instead of being cut */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 22px), transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 22px), transparent 100%);
  transition: scrollbar-color .2s;
}
.sidebar-nav:hover, .sidebar-nav:focus-within { scrollbar-color: rgba(255, 255, 255, .22) transparent; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: transparent; border-radius: 6px; }
.sidebar-nav:hover::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .32); }
.sidebar .nav-link .nav-text { overflow: hidden; text-overflow: ellipsis; }
.nav-section { font-size: .66rem; letter-spacing: .09em; text-transform: uppercase; font-weight: 700; color: var(--os-sidebar-muted); padding: 1rem .75rem .4rem; white-space: nowrap; }
.sidebar .nav-link {
  display: flex; align-items: center; gap: .8rem; color: var(--os-sidebar-text); border-radius: 10px;
  padding: .6rem .75rem; font-weight: 500; white-space: nowrap; transition: background .15s, color .15s;
}
.sidebar .nav-link i.nav-icon { font-size: 1.1rem; width: 1.3rem; text-align: center; flex-shrink: 0; }
.sidebar .nav-link:hover { background: var(--os-sidebar-hover); color: #fff; }
.sidebar .nav-link.active { background: var(--os-sidebar-active); color: #fff; }
.sidebar .nav-link.active i.nav-icon { color: #a5b4fc; }
.sidebar .nav-link .chevron { margin-left: auto; font-size: .75rem; transition: transform .2s; }
.sidebar .nav-link[aria-expanded="true"] .chevron { transform: rotate(90deg); }
.sidebar .nav-link[aria-expanded="true"] { color: #fff; }
.sidebar .submenu { list-style: none; padding: .2rem 0 .35rem 2.15rem; margin: 0; position: relative; }
.sidebar .submenu::before { content: ''; position: absolute; left: 1.35rem; top: .2rem; bottom: .4rem; width: 1px; background: rgba(255, 255, 255, .1); }
.sidebar .submenu .nav-link { padding: .42rem .75rem; font-size: .86rem; color: #94a3b8; }
.sidebar .submenu .nav-link.active { background: transparent; color: #fff; font-weight: 600; }
.sidebar .submenu .nav-link.active::before { content: ''; position: absolute; left: 1.17rem; width: 7px; height: 7px; border-radius: 50%; background: #818cf8; }
.sidebar-footer { padding: .9rem 1rem; border-top: 1px solid rgba(255, 255, 255, .06); display: flex; align-items: center; gap: .7rem; flex-shrink: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #334155; color: #fff; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.sidebar-footer .user-meta { min-width: 0; white-space: nowrap; overflow: hidden; }
.sidebar-footer .user-meta small { color: var(--os-sidebar-muted); }
.sidebar-backdrop { display: none; }

/* collapsed desktop sidebar (expands on hover) */
@media (min-width: 992px) {
  body.sidebar-collapsed .sidebar:not(:hover) { width: var(--os-sidebar-w-collapsed); }
  body.sidebar-collapsed .app-main { margin-left: var(--os-sidebar-w-collapsed); }
  body.sidebar-collapsed .sidebar:not(:hover) .brand-text,
  body.sidebar-collapsed .sidebar:not(:hover) .nav-text,
  body.sidebar-collapsed .sidebar:not(:hover) .chevron,
  body.sidebar-collapsed .sidebar:not(:hover) .user-meta,
  body.sidebar-collapsed .sidebar:not(:hover) .sidebar-footer form { display: none; }
  body.sidebar-collapsed .sidebar:not(:hover) .nav-section { visibility: hidden; height: .6rem; padding: 0; }
  body.sidebar-collapsed .sidebar:not(:hover) .submenu { display: none; }
  body.sidebar-collapsed .sidebar:not(:hover) .nav-link { justify-content: center; }
  body.sidebar-collapsed .sidebar:hover { box-shadow: 8px 0 30px rgba(0, 0, 0, .25); }
}

/* mobile off-canvas sidebar */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .app-main { margin-left: 0; }
  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 10px 0 40px rgba(0, 0, 0, .35); }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 1035; backdrop-filter: blur(2px); }
  body.sidebar-open { overflow: hidden; }
  .app-content { padding: 1rem; }
}

/* ------------------------------------------------------------------ topbar */
.topbar {
  height: var(--os-topbar-h); background: rgba(255, 255, 255, .85); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--os-border); display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem; position: sticky; top: 0; z-index: 1020;
}
.topbar .btn-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--os-border); background: #fff; color: #334155; }
.topbar .btn-icon:hover { background: var(--os-primary-soft); color: var(--os-primary); }
.topbar-title { font-weight: 700; font-size: 1.05rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 575.98px) { .topbar { padding: 0 1rem; } }

/* ------------------------------------------------------------ page header */
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.45rem; font-weight: 800; margin: 0; letter-spacing: -.01em; }
.page-header .subtitle { color: var(--os-muted); margin: .2rem 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ------------------------------------------------------------------ cards */
.card { border: 1px solid var(--os-border); border-radius: var(--os-radius); box-shadow: var(--os-shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--os-border); padding: .9rem 1.15rem; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.card-header .card-title { margin: 0; font-size: .98rem; font-weight: 700; }
.card-body { padding: 1.15rem; }

.stat-card { padding: 1.1rem 1.2rem; display: flex; gap: 1rem; align-items: flex-start; height: 100%; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-label { color: var(--os-muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; word-break: break-word; }
.stat-sub { font-size: .78rem; color: var(--os-muted); }

.bg-soft-primary { background: #eef2ff; color: #4f46e5; }
.bg-soft-success { background: #dcfce7; color: #15803d; }
.bg-soft-warning { background: #fef3c7; color: #b45309; }
.bg-soft-danger { background: #fee2e2; color: #b91c1c; }
.bg-soft-info { background: #e0f2fe; color: #0369a1; }
.bg-soft-purple { background: #f3e8ff; color: #7e22ce; }
.bg-soft-secondary { background: #f1f5f9; color: #475569; }

/* ----------------------------------------------------------------- badges */
.badge-soft { font-weight: 600; padding: .38em .7em; border-radius: 999px; font-size: .74rem; white-space: nowrap; }
.badge-soft-primary { background: #e0e7ff; color: #3730a3; }
.badge-soft-success { background: #dcfce7; color: #166534; }
.badge-soft-warning { background: #fef3c7; color: #92400e; }
.badge-soft-danger { background: #fee2e2; color: #991b1b; }
.badge-soft-info { background: #e0f2fe; color: #075985; }
.badge-soft-secondary { background: #f1f5f9; color: #475569; }
.badge-soft-dark { background: #e2e8f0; color: #0f172a; }
.badge-soft-indigo { background: #e0e7ff; color: #4338ca; }
.badge-soft-purple { background: #f3e8ff; color: #6b21a8; }
.badge-soft-teal { background: #ccfbf1; color: #115e59; }
.badge-soft-orange { background: #ffedd5; color: #9a3412; }

/* ----------------------------------------------------------------- tables */
/* Tables never squash: cells stay on one line and the wrapper scrolls horizontally. */
.table-responsive {
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent;
  background:
    linear-gradient(90deg, #fff 30%, rgba(255,255,255,0)) left center / 32px 100% no-repeat local,
    linear-gradient(270deg, #fff 30%, rgba(255,255,255,0)) right center / 32px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(15,23,42,.12), transparent) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(15,23,42,.12), transparent) right center / 12px 100% no-repeat scroll;
}
.table-responsive::-webkit-scrollbar { height: 8px; width: 8px; }
.table-responsive::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.table-responsive::-webkit-scrollbar-track { background: transparent; }
.card > .table-responsive, .card > .table-wrap > .table-responsive { border-radius: 0 0 var(--os-radius) var(--os-radius); }

.table { --bs-table-bg: transparent; margin-bottom: 0; width: 100%; font-size: .92rem; border-collapse: separate; border-spacing: 0; }
.table > :not(caption) > * > * { padding: .72rem 1rem; vertical-align: middle; border-bottom: 1px solid #eef0f4; white-space: nowrap; }
.table > thead th {
  font-family: var(--os-font); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: #64748b; font-weight: 600; background: #f8fafc; border-bottom: 1px solid var(--os-border);
  position: sticky; top: 0; z-index: 2; text-align: left;
}
.table > tbody > tr:last-child > td { border-bottom: 0; }
.table > tfoot td, .table > tfoot th { background: #f8fafc; font-weight: 700; border-top: 1px solid var(--os-border); border-bottom: 0; }
.table-sm > :not(caption) > * > * { padding: .5rem .8rem; }
.table-hover > tbody > tr { transition: background-color .12s; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f6f8ff; background-color: #f6f8ff; }

/* Sticky action column: stays visible on the right while the table scrolls horizontally */
.table .col-actions,
.table:has(td.col-actions) > thead > tr > th:last-child,
.table:has(td.col-actions) > tfoot > tr > td:last-child {
  position: sticky; right: 0; z-index: 1;
  background-color: #fff;
  box-shadow: inset 1px 0 0 var(--os-border), -10px 0 12px -10px rgba(15, 23, 42, .18);
}
.table:has(td.col-actions) > thead > tr > th:last-child { z-index: 3; background-color: #f8fafc; }
.table:has(td.col-actions) > tfoot > tr > td:last-child { background-color: #f8fafc; }
.table-hover > tbody > tr:hover > .col-actions { background-color: #f6f8ff; }
.table .col-actions .btn + .btn, .table .col-actions .btn + form, .table .col-actions form + .btn { margin-left: .2rem; }

/* alignment helpers */
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.text-end, .table th.text-end { text-align: right; }
.table td:first-child, .table th:first-child { padding-left: 1.15rem; }
.table td:last-child, .table th:last-child { padding-right: 1.15rem; }
.table td > .small, .table td > div.small { line-height: 1.35; margin-top: 1px; }
.table code { font-size: .8rem; color: #4338ca; background: #eef2ff; padding: .1rem .35rem; border-radius: 5px; }
.table .btn-sm { padding: .25rem .5rem; }
.table form.d-inline { display: inline-block; }
/* long free-text cells may wrap instead of stretching the table */
.table td.wrap, .table .cell-wrap { white-space: normal; min-width: 180px; max-width: 320px; }
.table .progress { min-width: 90px; }
.table .carton-input { min-width: 80px; }
.table .empty-state { white-space: normal; }
.table tr.row-editing .form-control { min-width: 90px; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--os-muted); }
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: .5rem; color: #cbd5e1; }
.row-editing > td { background: #fffbeb !important; }
.text-loss { color: #dc2626 !important; }
.text-gain { color: #16a34a !important; }

/* ---------------------------------------------------------------- filters */
.filter-card .card-body { padding: 1rem 1.15rem; }
.period-pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.period-pills .btn { border-radius: 999px; font-weight: 600; font-size: .8rem; padding: .35rem .85rem; }
.period-pills .btn-check:checked + .btn { background: var(--os-primary); border-color: var(--os-primary); color: #fff; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-request.table-wrap, .htmx-request .table-wrap { opacity: .55; transition: opacity .2s; }

/* ------------------------------------------------------------ misc pieces */
.summary-list { list-style: none; padding: 0; margin: 0; }
.summary-list li { display: flex; justify-content: space-between; padding: .5rem 0; border-bottom: 1px dashed var(--os-border); gap: 1rem; }
.summary-list li:last-child { border-bottom: 0; }
.summary-list .total { font-size: 1.05rem; font-weight: 800; }
.progress { height: .5rem; border-radius: 999px; background: #eef0f4; }
.preview-box { width: 100%; max-width: 220px; height: 110px; border: 1px dashed #cbd5e1; border-radius: 12px; display: grid; place-items: center; background: #f8fafc; overflow: hidden; }
.preview-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-box.sm { max-width: 90px; height: 90px; }
.customer-block { border: 1px solid var(--os-border); border-radius: 12px; overflow: hidden; margin-bottom: 1rem; }
.customer-block-header { background: #f8fafc; padding: .7rem 1rem; display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--os-border); }
.carton-input { width: 90px; text-align: right; }
.order-pick { cursor: pointer; }
.order-pick:has(input:checked) { background: var(--os-primary-soft); }
.timeline-step { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--os-muted); }
.timeline-step.done { color: #16a34a; font-weight: 600; }
.timeline-step.current { color: var(--os-primary); font-weight: 700; }
.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; margin: 0; }
.dl-grid dt { color: var(--os-muted); font-weight: 500; }
.dl-grid dd { margin: 0; font-weight: 600; word-break: break-word; }

/* ------------------------------------------------------------- login page */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }
.auth-hero {
  background: radial-gradient(circle at 20% 20%, #6366f1 0, transparent 45%), radial-gradient(circle at 80% 70%, #8b5cf6 0, transparent 40%), #0f172a;
  color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.auth-hero h2 { font-weight: 800; font-size: 2.1rem; line-height: 1.2; letter-spacing: -.02em; }
.auth-hero .feature { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1rem; color: #cbd5e1; }
.auth-hero .feature i { color: #a5b4fc; font-size: 1.2rem; }
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 410px; }
.auth-card h1 { font-weight: 800; font-size: 1.7rem; letter-spacing: -.02em; }
.auth-card .form-control { padding: .75rem 1rem; }
.auth-card .input-icon { position: relative; }
.auth-card .input-icon i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.auth-card .input-icon .form-control { padding-left: 2.6rem; }
.auth-card .btn-lg { padding: .8rem 1rem; font-size: 1rem; }
@media (max-width: 991.98px) { .auth-page { grid-template-columns: 1fr; } .auth-hero { display: none; } }

/* ------------------------------------------------------------------ print */
@media print { .sidebar, .topbar, .page-actions, .filter-card { display: none !important; } .app-main { margin: 0 !important; } }

/* SweetAlert2 font */
.swal2-popup { font-family: var(--os-font) !important; border-radius: 16px !important; }

/* ==========================================================================
   Reference numbers (order / invoice / factory batch / receipt)
   Monospace chip with tabular digits so numbers are easy to read & line up.
   ========================================================================== */
.ref {
  display: inline-flex; align-items: center; gap: .3rem;
  font-family: var(--os-font-mono); font-size: .8rem; font-weight: 600;
  font-variant-numeric: tabular-nums slashed-zero; letter-spacing: .01em; line-height: 1.2;
  color: #3730a3; background: #eef2ff; border: 1px solid #e0e7ff;
  padding: .22rem .55rem; border-radius: 7px; white-space: nowrap; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
a.ref:hover { background: #e0e7ff; border-color: #c7d2fe; color: #312e81; }
a.ref:focus-visible { outline: 2px solid #818cf8; outline-offset: 2px; }
.ref-static { color: #334155; background: #f1f5f9; border-color: #e2e8f0; }
.table td > .ref { vertical-align: middle; }
.table td > .ref + .small, .table td > .ref + div { margin-top: .3rem; }
.list-group-item .ref + .small { margin-top: .25rem; }
.customer-block-header .ref { font-size: .76rem; padding: .15rem .45rem; }
p .ref, .card-body .ref { vertical-align: baseline; }

/* ==========================================================================
   Scrollbars & overflow across the app
   ========================================================================== */
html { scrollbar-gutter: stable; }
* { scrollbar-width: thin; scrollbar-color: var(--os-scroll-thumb) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background-color: var(--os-scroll-thumb); border-radius: 10px;
  border: 3px solid transparent; background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--os-scroll-thumb-hover); }
*::-webkit-scrollbar-corner { background: transparent; }

/* table scroll areas: slim horizontal bar */
.table-responsive { overscroll-behavior-x: contain; }
.table-responsive::-webkit-scrollbar { height: 9px; }

/* fixed-height scroll boxes (order picker, add-orders list, etc.) */
.scroll-box {
  overflow: auto; overscroll-behavior: contain;
  border: 1px solid var(--os-border); border-radius: 10px; background: #fff;
}
.card > .scroll-box { border: 0; border-radius: 0; }

/* dropdown menus never run off-screen */
.dropdown-menu { max-height: min(70vh, 460px); overflow-y: auto; overscroll-behavior: contain; border-radius: 12px; padding: .4rem; }
.dropdown-item { border-radius: 8px; padding: .45rem .75rem; }

/* long text never breaks layout */
.page-header h1 { overflow-wrap: anywhere; }
.card-header .card-title, .stat-value { min-width: 0; overflow-wrap: anywhere; }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
pre, code { white-space: pre-wrap; overflow-wrap: anywhere; }
.table code { white-space: nowrap; }
