/* ==========================================================================
   Appsoware — Innovate. Integrate. Elevate.
   Order Management • app.css  (v3 — Appsoware brand theme)

   A clean, responsive admin interface. Mobile-first, accessible, print-ready.
   Class names & CSS custom-property names are unchanged from the previous
   build, so every PHP page (incl. inline page styles) re-themes automatically
   from the token block below — no page markup or layout was restructured.
   ========================================================================== */

/* ------------------------------------------------------------------ *
 * 1. Design tokens
 * ------------------------------------------------------------------ */
:root {
  /* Brand — blue, sampled straight from the Appsoware "A" mark */
  --brand:        #0a6fe0;
  --brand-d:      #0b4fa8;
  --brand-l:      #eef6ff;
  --brand-m:      #4fa9ff;
  --brand-ring:   rgba(10, 111, 224, .22);
  --brand-grad:   linear-gradient(135deg, #00b4f0 0%, #0a6fe0 55%, #0b3c8c 100%);
  --brand-cyan:   #00b4f0;
  --brand-navy:   #0b2a63;

  /* Accent — the orange swoosh from the mark */
  --accent:       #f97316;
  --accent-d:     #ea580c;
  --accent-l:     #fff4ec;
  --accent-m:     #fdba74;
  --accent-grad:  linear-gradient(135deg, #fb923c 0%, #f97316 55%, #ea4a0c 100%);

  /* Sidebar (deep Appsoware navy) */
  --sidebar-bg:   #0b1f45;
  --sidebar-bg-2: #071531;
  --sidebar-hv:   rgba(255, 255, 255, .07);
  --sidebar-tx:   #93a8c9;
  --sidebar-ak:   #ff8a3d;

  /* Status */
  --success:      #059669;
  --success-bg:   #ecfdf5;
  --warning:      #d97706;
  --warning-bg:   #fffbeb;
  --danger:       #dc2626;
  --danger-bg:    #fef2f2;
  --info:         #2563eb;
  --info-bg:      #eff6ff;

  /* Neutrals / surfaces — very slightly cooled to sit under the blue brand */
  --bg:           #f2f5fa;
  --surface:      #ffffff;
  --surface-2:    #f7f9fd;
  --border:       #e4eaf3;
  --border-2:     #edf1f8;
  --text:         #0f172a;
  --muted:        #64748b;
  --subtle:       #94a3b8;

  /* Metrics */
  --sidebar-w:    250px;
  --topbar-h:     60px;

  --r-sm:         8px;
  --r:            12px;
  --r-lg:         16px;

  --sh-sm:        0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --sh-md:        0 4px 12px rgba(15, 23, 42, .07), 0 2px 4px rgba(15, 23, 42, .04);
  --sh-lg:        0 12px 32px rgba(15, 23, 42, .14);
  --ring:         0 0 0 3px var(--brand-ring);

  --font:         'Inter', 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono:         'JetBrains Mono', 'DM Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --t:            .18s cubic-bezier(.4, 0, .2, 1);
}

/* ------------------------------------------------------------------ *
 * 2. Reset & base
 * ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh;
}

h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; letter-spacing: -.011em; }
a { color: var(--brand-d); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
svg { display: block; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }

.font-mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }

/* Small layout utilities used inline across pages */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.full { width: 100%; }

::selection { background: var(--brand-m); color: #04203f; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Refined scrollbars */
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }

/* ------------------------------------------------------------------ *
 * 3. App shell — sidebar
 * ------------------------------------------------------------------ */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-tx);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  border-right: 1px solid rgba(255, 255, 255, .04);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  position: relative;
}
.sidebar-brand::after {
  content: '';
  position: absolute; left: 18px; right: 18px; bottom: -1px; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand-cyan) 0%, var(--brand) 45%, var(--accent) 100%);
  opacity: .85;
}
.sidebar-logo {
  width: 42px; height: 42px;
  border-radius: 11px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.sidebar-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-text { min-width: 0; }
.brand-name {
  font-size: 15px; font-weight: 700; color: #fff; letter-spacing: -.01em;
  line-height: 1.1;
}
.brand-sub {
  font-size: 11px; color: var(--sidebar-tx); margin-top: 2px;
  letter-spacing: .02em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 8px;
  -webkit-overflow-scrolling: touch;
}
.nav-section {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: #5b6b82;
  padding: 16px 12px 7px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  margin-bottom: 2px;
  border-radius: var(--r-sm);
  color: var(--sidebar-tx);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--t), color var(--t);
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--sidebar-hv); color: #e2e8f0; text-decoration: none; }
.nav-item.active {
  background: var(--sidebar-hv);
  color: #fff;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--sidebar-ak);
}
.nav-item.active svg { color: var(--sidebar-ak); }

/* Install-app button */
.btn-install-app {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; width: 100%;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  border: 1px dashed rgba(255, 138, 61, .38);
  background: rgba(255, 138, 61, .08);
  color: var(--sidebar-ak);
  font-size: 13px; font-weight: 600;
  transition: background var(--t);
}
.btn-install-app:hover { background: rgba(255, 138, 61, .16); }
.btn-install-app svg { width: 17px; height: 17px; }

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, .06);
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--brand-grad);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 13px; font-weight: 600; color: #e2e8f0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role { font-size: 11px; color: var(--sidebar-tx); text-transform: capitalize; }
.btn-logout {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--sidebar-tx);
  transition: background var(--t), color var(--t);
  flex-shrink: 0;
}
.btn-logout svg { width: 18px; height: 18px; }
.btn-logout:hover { background: rgba(220, 38, 38, .15); color: #fca5a5; }

.sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(2px);
  z-index: 999;
  opacity: 0; visibility: hidden;
  transition: opacity var(--t), visibility var(--t);
}
.sidebar-backdrop.show { opacity: 1; visibility: visible; }

/* ------------------------------------------------------------------ *
 * 4. Topbar
 * ------------------------------------------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  margin-left: var(--sidebar-w);
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 -3px 0 -2px var(--brand);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  padding-left: max(22px, env(safe-area-inset-left));
  padding-right: max(22px, env(safe-area-inset-right));
  z-index: 500;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.page-title {
  font-size: 17px; font-weight: 700; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-toggle {
  display: inline-flex;
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  color: var(--text);
  align-items: center; justify-content: center;
  transition: background var(--t);
}
.sidebar-toggle:hover { background: var(--surface-2); }
.sidebar-toggle svg { width: 22px; height: 22px; }

/* ------------------------------------------------------------------ *
 * 5. Main content
 * ------------------------------------------------------------------ */
.main-content {
  margin-left: var(--sidebar-w);
  padding: 24px;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
  padding-bottom: max(40px, env(safe-area-inset-bottom));
  max-width: 1480px;
}

/* ------------------------------------------------------------------ *
 * 6. Buttons
 * ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background var(--t), border-color var(--t), box-shadow var(--t), transform .08s, color var(--t);
  text-decoration: none;
  user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 2px rgba(10, 111, 224, .28);
}
.btn-primary:hover { background: var(--brand-d); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--sh-sm);
}
.btn-secondary:hover { background: var(--surface-2); border-color: #d4dae3; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 1px 2px rgba(220, 38, 38, .25);
}
.btn-danger:hover { background: #b91c1c; }

.btn-sm { padding: 8px 13px; font-size: 12.5px; border-radius: 7px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { padding: 13px 26px; font-size: 15px; }

.btn-icon { padding: 8px; }
.btn-icon svg { width: 16px; height: 16px; }
.btn-sm.btn-icon { padding: 7px; }

.btn-group { display: flex; flex-wrap: wrap; gap: 10px; }

/* ------------------------------------------------------------------ *
 * 7. Cards
 * ------------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h2 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.card-body { padding: 20px; }

/* ------------------------------------------------------------------ *
 * 8. Stat cards & dashboard grid
 * ------------------------------------------------------------------ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
  padding: 17px 18px;
  transition: box-shadow var(--t), transform var(--t);
}
.stat-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.stat-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 23px; height: 23px; }
.stat-icon.indigo { background: var(--brand-l);  color: var(--brand); }
.stat-icon.blue   { background: var(--brand-l);  color: var(--brand); }
.stat-icon.orange { background: var(--accent-l); color: var(--accent-d); }
.stat-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-icon.amber  { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red    { background: var(--danger-bg);  color: var(--danger); }
.stat-value {
  font-size: 24px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  align-items: start;
}

/* ------------------------------------------------------------------ *
 * 9. Tables
 * ------------------------------------------------------------------ */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  padding: 11px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-2);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--surface-2); }

.low-stock { color: var(--danger); font-weight: 700; }
.table-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }

/* Pagination */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
}
.pagination a, .pagination span {
  min-width: 34px; height: 34px;
  padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: background var(--t), border-color var(--t);
}
.pagination a:hover { background: var(--surface-2); border-color: #d4dae3; text-decoration: none; }
.pagination .active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* ------------------------------------------------------------------ *
 * 10. Forms
 * ------------------------------------------------------------------ */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
}
.form-group label.required::after,
label.required::after { content: ' *'; color: var(--danger); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

input[type=text], input[type=password], input[type=number],
input[type=date], input[type=email], input[type=tel],
input[type=search], select, textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 13.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
  -webkit-appearance: none;
  appearance: none;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--subtle); }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover { border-color: #d0d7e2; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}
input:disabled, input[readonly], select:disabled {
  background: var(--surface-2);
  color: var(--muted);
  cursor: not-allowed;
}
input[readonly] { cursor: default; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 36px;
}

/* Search bar (orders / lists) */
.search-bar {
  position: relative;
  flex: 1 1 220px;
  min-width: 200px;
  max-width: 380px;
  display: flex;
  align-items: center;
}
.search-bar svg {
  position: absolute; left: 12px;
  width: 17px; height: 17px;
  color: var(--subtle);
  pointer-events: none;
}
.search-bar input { padding-left: 38px; }

.orders-filter-row { gap: 10px; }
.orders-filter-row > select,
.orders-filter-row > input[type=date],
.orders-filter-row > input[type=text]:not(.search-bar input) {
  width: auto;
  flex: 0 0 auto;
}
.orders-filter-row > input[type=date] { min-width: 150px; }
.orders-count-badge { white-space: nowrap; }

/* Labeled, responsive orders filter */
.orders-filter .filter-grid { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.orders-filter .ff { display: flex; flex-direction: column; gap: 5px; }
.orders-filter .ff > label { font-size: 11px; font-weight: 600; color: var(--muted); }
.orders-filter .ff-search { flex: 1 1 240px; min-width: 200px; }
.orders-filter .ff-search .search-bar { min-width: 0; max-width: none; flex: 1; }
.orders-filter .ff select, .orders-filter .ff input[type=date] { min-width: 150px; }
.orders-filter .ff-actions { flex-direction: row; gap: 8px; margin-left: auto; }
.orders-filter .filter-meta { margin-top: 12px; font-size: 12.5px; color: var(--muted); text-align: right; }
@media (max-width: 768px) {
  .orders-filter .ff-search { flex-basis: 100%; }
  .orders-filter .ff { flex: 1 1 calc(50% - 6px); }
  .orders-filter .ff-actions { flex-basis: 100%; margin-left: 0; }
  .orders-filter .ff-actions .btn { flex: 1; }
  .orders-filter .filter-meta { text-align: center; }
}
@media (max-width: 430px) {
  .orders-filter .ff { flex-basis: 100%; }
}

/* Hide non-essential table columns on small screens */
@media (max-width: 560px) { .hide-sm { display: none !important; } }

/* Sidebar stock-deduction toggle */
.sidebar-settings { padding: 2px 12px 4px; }
.stock-toggle {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; border-radius: 10px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09);
  color: #cbd5e1; font-size: 12.5px; font-family: inherit; cursor: pointer;
  text-align: left; transition: background .15s, border-color .15s;
}
.stock-toggle:hover { background: rgba(255,255,255,.1); }
.stock-toggle .st-ico { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }
.stock-toggle .st-text { flex: 1; line-height: 1.2; }
.stock-toggle .st-text strong { font-weight: 700; color: #94a3b8; }
.stock-toggle.on { color: #a7f3d0; border-color: rgba(16,185,129,.4); }
.stock-toggle.on .st-ico { opacity: 1; }
.stock-toggle.on .st-text strong { color: #34d399; }
.st-switch { position: relative; width: 34px; height: 20px; flex-shrink: 0; border-radius: 999px; background: rgba(255,255,255,.2); transition: background .15s; }
.stock-toggle.on .st-switch { background: #10b981; }
.st-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.stock-toggle.on .st-knob { left: 16px; }

/* ------------------------------------------------------------------ *
 * 11. Badges
 * ------------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: .01em;
  line-height: 1.5;
  white-space: nowrap;
}
.badge-pending    { background: var(--warning-bg); color: #b45309; }
.badge-confirmed  { background: var(--info-bg);    color: #1d4ed8; }
.badge-dispatched { background: #f3e8ff;           color: #7e22ce; }
.badge-delivered  { background: var(--success-bg); color: #047857; }
.badge-cancelled  { background: var(--danger-bg);  color: #b91c1c; }
.badge-active     { background: var(--success-bg); color: #047857; }
.badge-inactive   { background: #f1f5f9;           color: #64748b; }

.free-qty-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--success-bg);
  color: #047857;
  font-size: 10.5px;
  font-weight: 700;
}

/* ------------------------------------------------------------------ *
 * 12. Alerts
 * ------------------------------------------------------------------ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert button {
  margin-left: auto;
  font-size: 20px;
  line-height: 1;
  color: inherit;
  opacity: .55;
  padding: 0 2px;
  transition: opacity var(--t);
}
.alert button:hover { opacity: 1; }
.alert-success { background: var(--success-bg); color: #065f46; border-color: #a7f3d0; }
.alert-warning { background: var(--warning-bg); color: #92400e; border-color: #fcd9a5; }
.alert-danger  { background: var(--danger-bg);  color: #991b1b; border-color: #fbcaca; }
.alert-info    { background: var(--info-bg);    color: #1e40af; border-color: #bfdbfe; }

/* ------------------------------------------------------------------ *
 * 13. Order totals & "new order" extras
 * ------------------------------------------------------------------ */
.order-total-box,
.order-total-row.grand,
.order-total-row {
  font-variant-numeric: tabular-nums;
}
.order-total-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
}
.order-total-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  font-size: 14px;
  color: var(--muted);
}
.order-total-row span:last-child { color: var(--text); font-weight: 600; font-family: var(--mono); }
.order-total-row.grand {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 2px solid var(--border);
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}
.order-total-row.grand span:last-child { color: var(--brand-d); font-weight: 800; }

.add-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  border: 1.5px dashed var(--brand-m);
  background: var(--brand-l);
  color: var(--brand-d);
  font-size: 13.5px;
  font-weight: 600;
  transition: background var(--t), border-color var(--t);
}
.add-row-btn:hover { background: #dfeeff; border-color: var(--brand); }

/* Stock banner (new-order page) */
.stock-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
}
.stock-banner.on  { background: var(--success-bg); color: #065f46; border-color: #a7f3d0; }
.stock-banner.off { background: var(--surface-2);  color: var(--muted); border-color: var(--border); }

/* ------------------------------------------------------------------ *
 * 14. Masters layout
 * ------------------------------------------------------------------ */
.masters-layout.single { grid-template-columns: 1fr; }
.masters-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}

/* ------------------------------------------------------------------ *
 * 15. Invoice (order_view) — base styles; page also has scoped tweaks
 * ------------------------------------------------------------------ */
.invoice-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 24px; flex-wrap: wrap; }
.invoice-company h2 { font-size: 22px; font-weight: 800; color: var(--brand-d); letter-spacing: -.02em; }
.invoice-meta { text-align: right; }
.invoice-meta .order-no { font-size: 18px; font-weight: 700; font-family: var(--mono); }
.invoice-parties {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 22px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 18px;
}
.invoice-party h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.invoice-party p { font-size: 13.5px; line-height: 1.6; }

.inv-table th { background: var(--sidebar-bg); color: #fff; border-color: rgba(255,255,255,.12); }
.inv-table td { font-size: 13px; }
.inv-total { display: flex; justify-content: flex-end; }
.inv-total-box { min-width: 280px; margin-top: 16px; }
.inv-row { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.inv-row.grand { font-size: 16px; font-weight: 800; border-top: 2px solid var(--border); margin-top: 6px; padding-top: 9px; color: var(--brand-d); }

/* ------------------------------------------------------------------ *
 * 16. Dialog (modal)
 * ------------------------------------------------------------------ */
.dlg-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 9000;
  opacity: 0; visibility: hidden;
  transition: opacity .2s, visibility .2s;
}
.dlg-overlay.show { opacity: 1; visibility: visible; }
.dlg-box {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  width: 100%; max-width: 420px;
  overflow: hidden;
  transform: translateY(8px) scale(.97);
  transition: transform .22s cubic-bezier(.34, 1.56, .64, 1);
}
.dlg-overlay.show .dlg-box { transform: translateY(0) scale(1); }
.dlg-head { padding: 26px 26px 20px; text-align: center; }
.dlg-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid; place-items: center;
  margin: 0 auto 16px;
}
.dlg-icon svg { width: 30px; height: 30px; }
.dlg-icon.error   { background: var(--danger-bg);  color: var(--danger); }
.dlg-icon.success { background: var(--success-bg); color: var(--success); }
.dlg-icon.warning { background: var(--warning-bg); color: var(--warning); }
.dlg-icon.confirm { background: var(--brand-l);    color: var(--brand-d); }
.dlg-icon.info    { background: var(--info-bg);    color: var(--info); }
.dlg-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.dlg-msg { font-size: 14px; color: var(--muted); line-height: 1.6; }
.dlg-list {
  text-align: left;
  list-style: none;
  background: var(--danger-bg);
  border: 1px solid #fbcaca;
  border-radius: var(--r-sm);
  padding: 12px 14px;
  margin-top: 6px;
}
.dlg-list li {
  font-size: 13px; color: #991b1b; padding: 3px 0 3px 18px; position: relative;
}
.dlg-list li::before { content: '•'; position: absolute; left: 4px; color: var(--danger); }
.dlg-foot {
  display: flex; gap: 10px; justify-content: center;
  padding: 0 26px 24px;
}
.dlg-foot .btn { min-width: 110px; }

/* ------------------------------------------------------------------ *
 * 17. Toast
 * ------------------------------------------------------------------ */
.toast-container {
  position: fixed;
  top: 16px; right: 16px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9500;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--muted);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-lg);
  padding: 13px 15px;
  min-width: 280px;
  animation: toastIn .3s cubic-bezier(.34, 1.56, .64, 1);
}
.toast.success { border-left-color: var(--success); }
.toast.danger  { border-left-color: var(--danger); }
.toast.info    { border-left-color: var(--info); }
.toast.warning { border-left-color: var(--warning); }
.toast-ico { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.toast-ico.success { color: var(--success); }
.toast-ico.danger  { color: var(--danger); }
.toast-ico.info    { color: var(--info); }
.toast-ico.warning { color: var(--warning); }
.toast-body { flex: 1; min-width: 0; }
.toast-msg { font-size: 13.5px; font-weight: 500; line-height: 1.45; }
.toast-close {
  font-size: 18px; line-height: 1; color: var(--subtle);
  padding: 0 2px; transition: color var(--t);
}
.toast-close:hover { color: var(--text); }

@keyframes toastIn  { from { opacity: 0; transform: translateX(110%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); }    to { opacity: 0; transform: translateX(110%); } }

/* ------------------------------------------------------------------ *
 * 18. Login
 * ------------------------------------------------------------------ */
.login-bg {
  min-height: 100vh; min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}
.login-art {
  position: relative;
  overflow: hidden;
  background: linear-gradient(150deg, #0b3c8c 0%, #0a6fe0 48%, #071f4a 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.login-art-circles span {
  position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, .07);
}
.login-art-circles span:nth-child(1) { width: 360px; height: 360px; top: -90px; left: -90px; }
.login-art-circles span:nth-child(2) { width: 240px; height: 240px; bottom: -70px; right: -50px; background: rgba(249, 115, 22, .18); }
.login-art-circles span:nth-child(3) { width: 150px; height: 150px; top: 45%; right: 12%; background: rgba(255, 255, 255, .05); }
.login-art-content { position: relative; z-index: 1; text-align: center; color: #fff; max-width: 360px; }
.login-art-logo {
  width: min(300px, 80%);
  margin: 0 auto 20px;
  display: grid; place-items: center;
  /* drop-shadow follows the artwork's alpha, unlike box-shadow which would
     draw a rectangle around a transparent PNG. */
  filter: drop-shadow(0 10px 28px rgba(0, 0, 0, .30));
}
.login-art-logo img { width: 100%; height: auto; }
.login-art-company { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.login-art-divider {
  width: 84px; height: 3px; border-radius: 3px; margin: 16px auto;
  background: linear-gradient(90deg, var(--brand-cyan) 0%, #ffffff 50%, var(--accent) 100%);
}
.login-art-tagline { font-size: 15px; color: rgba(255, 255, 255, .85); font-weight: 500; }

.login-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
  background: var(--bg);
}
.login-box { width: 100%; max-width: 380px; }
.login-mobile-brand { display: none; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-mobile-brand img { width: 52px; height: 52px; object-fit: contain; }
.login-mobile-brand.lockup img { width: auto; height: 46px; }
.login-mobile-brand-name { font-size: 18px; font-weight: 800; color: var(--brand-d); }
.login-mobile-brand-tagline { font-size: 12.5px; color: var(--muted); }
.login-welcome { font-size: 26px; font-weight: 800; letter-spacing: -.03em; margin-bottom: 6px; }
.login-sub { font-size: 14px; color: var(--muted); margin-bottom: 28px; }
.login-box .btn-primary { width: 100%; padding: 13px; font-size: 15px; }
.login-hint {
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted); text-align: center;
}
.login-hint code {
  font-family: var(--mono); font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 6px; color: var(--brand-d);
}

/* ------------------------------------------------------------------ *
 * 18b. Searchable picker (.pick-*) — customers & products forms
 * ------------------------------------------------------------------ */
.pick-wrap { position: relative; }
.pick-input { width: 100%; cursor: pointer; }
.pick-input:focus { cursor: text; }
.pick-drop {
  position: fixed;
  background: var(--surface);
  border: 1.5px solid var(--brand);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-lg);
  max-height: 240px;
  overflow-y: auto;
  z-index: 99998;
  display: none;
}
.pick-drop.open { display: block; }
.pick-opt {
  padding: 9px 12px;
  font-size: 13.5px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-2);
  transition: background .12s;
}
.pick-opt:last-child { border-bottom: none; }
.pick-opt:hover, .pick-opt.hl { background: var(--brand-l); }
.pick-opt-code { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.pick-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }

/* Master add/edit forms */
.master-form { display: flex; flex-direction: column; gap: 14px; }

/* ------------------------------------------------------------------ *
 * 19. Responsive
 * ------------------------------------------------------------------ */
@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .masters-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.4, 0, .2, 1);
    box-shadow: var(--sh-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar, .main-content { margin-left: 0; }
  .sidebar-toggle { display: inline-flex; }
  .main-content { padding: 16px; padding-bottom: max(40px, env(safe-area-inset-bottom)); }
  .topbar { padding: 0 14px; }
  .page-title { font-size: 16px; }
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .stat-card { padding: 14px; gap: 12px; }
  .stat-icon { width: 40px; height: 40px; }
  .stat-value { font-size: 21px; }
  .card-body { padding: 16px; }

  /* Stacked / label-based responsive tables */
  .responsive-table thead { display: none; }
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table tr {
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--sh-sm);
    margin-bottom: 8px;
    padding: 4px 14px;
    background: var(--surface);
  }
  .responsive-table tbody tr:hover td { background: transparent; }
  .responsive-table td {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 14px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border-2);
    text-align: right;
  }
  .responsive-table td > *:last-child { min-width: 0; overflow-wrap: break-word; word-break: break-word; }
  .responsive-table td:last-child { border-bottom: none; }
  .responsive-table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    text-align: left;
    flex-shrink: 0;
  }
  .responsive-table td[data-label=""]::before,
  .responsive-table td:not([data-label])::before { content: ''; }
  .responsive-table .table-actions { justify-content: flex-end; }

  /* Generic (non-responsive-table) tables — e.g. Dashboard's recent-orders /
     low-stock lists — get the same tighter row padding on small screens. */
  table:not(.responsive-table):not(.inv-table) tbody td { padding: 8px 12px; }
  table:not(.responsive-table):not(.inv-table) thead th { padding: 8px 12px; }

  /* List-page toolbar (search + filter badges + "View Inactive"/"+ Add …"
     buttons) — used on Products, Customers, Masters. On narrow screens the
     two halves used to sit on one row and push the Add button off-screen;
     now everything wraps and the search box goes full width. */
  .flex.justify-between.items-center.mb-4 {
    flex-wrap: wrap;
    row-gap: 10px;
  }
  .flex.justify-between.items-center.mb-4 > .flex {
    flex-wrap: wrap;
    width: 100%;
    row-gap: 8px;
  }
  .flex.justify-between.items-center.mb-4 .search-bar {
    min-width: 0;
    max-width: none;
    flex: 1 1 100%;
  }

  /* Filter rows stack and go full-width */
  .orders-filter-row { flex-direction: column; align-items: stretch; }
  .orders-filter-row .search-bar { min-width: 0; max-width: none; }
  .orders-filter-row select,
  .orders-filter-row input[type=date],
  .orders-filter-row .btn { width: 100%; }
  .orders-count-badge { margin-left: 0 !important; text-align: center; }

  /* Login -> single column. The art panel is replaced by the full lockup,
     centred; its adjacent text is dropped because the company name is already
     repeated by .login-welcome directly beneath it. */
  .login-bg { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-mobile-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-bottom: 24px;
  }
  .login-mobile-brand img { width: auto; height: 68px; }
  .login-mobile-brand > div { display: none; }
  .login-panel { align-items: flex-start; padding-top: 56px; }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar-right .btn span { display: none; }
  .topbar-right .btn { padding: 9px; }
}

/* Tablet/desktop: sidebar visible by default, collapsible via the hamburger */
@media (min-width: 769px) {
  .sidebar { transform: none; transition: transform .22s ease; }
  .topbar, .main-content { transition: margin-left .22s ease; }
  .sidebar-backdrop { display: none; }
  body.nav-collapsed .sidebar { transform: translateX(-100%); }
  body.nav-collapsed .topbar,
  body.nav-collapsed .main-content { margin-left: 0; }
}

/* ------------------------------------------------------------------ *
 * 19b. Extended responsive layer
 *
 * Everything below refines how the *existing* layout behaves at sizes the
 * original breakpoints didn't cover (small iPhones, large tablets, wide
 * desktops, landscape phones). No element is moved, renamed or restructured
 * — only spacing, sizing and wrapping are tuned per viewport.
 * ------------------------------------------------------------------ */

/* Nothing may push the page sideways on a phone. */
body { overflow-x: clip; }
body { -webkit-tap-highlight-color: rgba(10, 111, 224, .12); }

/* Common overflow culprits: flex/grid children default to min-width:auto,
   so long unbroken strings (emails, order numbers) blow the row out. */
.stat-card, .card, .form-group, .topbar-left, .user-info,
.dashboard-grid > *, .masters-layout > * { min-width: 0; }
.card-header h2, .page-title, .stat-label { overflow-wrap: break-word; }

/* Horizontal table scroll should not hand the gesture to the page. */
.table-wrapper { overscroll-behavior-x: contain; }

/* ---- Wide desktops & ultrawide ---------------------------------- */
@media (min-width: 1600px) {
  .main-content { max-width: 1640px; padding: 28px 32px; }
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
@media (min-width: 1920px) {
  .main-content { max-width: 1820px; }
}

/* ---- Small laptops / large tablets ------------------------------
   1024px-wide screens lose a quarter of their width to the sidebar, so
   trim it slightly instead of cramping the content column. */
@media (min-width: 769px) and (max-width: 1180px) {
  :root { --sidebar-w: 218px; }
  .main-content { padding: 20px; }
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

/* ---- Tablet portrait -------------------------------------------- */
@media (max-width: 900px) {
  .invoice-parties { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
}

/* ---- Phones ------------------------------------------------------ */
@media (max-width: 768px) {
  /* iOS Safari zooms the whole page when a focused field is under 16px.
     Compact in-card controls (product tiles) set their own size and are
     unaffected by this rule. */
  input[type=text], input[type=password], input[type=number],
  input[type=date], input[type=email], input[type=tel],
  input[type=search], select, textarea { font-size: 16px; }

  /* Comfortable touch targets without changing any button's role or place. */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 36px; }
  .nav-item { padding: 11px 12px; }
  .sidebar { width: min(var(--sidebar-w), 84vw); }

  /* Notch / home-indicator safe areas on iPhone. */
  .sidebar { padding-top: env(safe-area-inset-top); }
  .sidebar-nav { padding-bottom: 12px; }
  .sidebar-footer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }

  /* Toasts span the width so long messages stay readable. */
  .toast-container { left: 12px; right: 12px; top: max(12px, env(safe-area-inset-top)); max-width: none; }
  .toast { min-width: 0; width: 100%; }

  /* Modals breathe on small screens. */
  .dlg-overlay { padding: 16px; }
  .dlg-box { max-width: none; }
  .dlg-head { padding: 22px 20px 16px; }
  .dlg-foot { padding: 0 20px 20px; }
  .dlg-foot .btn { flex: 1; min-width: 0; }

  .btn-group > .btn { flex: 1 1 auto; }
  .card-header { padding: 14px 16px; }
}

/* ---- Small phones (iPhone SE / mini, 360–390px) ------------------ */
@media (max-width: 400px) {
  .main-content { padding: 12px; padding-bottom: max(32px, env(safe-area-inset-bottom)); }
  .topbar { padding: 0 10px; }
  .page-title { font-size: 15px; }
  .stats-grid { gap: 10px; }
  .stat-card { padding: 12px; gap: 10px; }
  .stat-icon { width: 36px; height: 36px; border-radius: 10px; }
  .stat-icon svg { width: 19px; height: 19px; }
  .stat-value { font-size: 19px; }
  .stat-label { font-size: 11.5px; }
  .card-body { padding: 14px; }
  .responsive-table tr { padding: 4px 12px; }
  /* Dashboard's compact tables side-scroll inside .table-wrapper by design;
     tighter cells mean far less of that scrolling on a 320–400px screen. */
  table:not(.responsive-table):not(.inv-table) thead th,
  table:not(.responsive-table):not(.inv-table) tbody td { padding: 7px 9px; }
  .pagination a, .pagination span { min-width: 32px; height: 32px; padding: 0 8px; font-size: 12.5px; }
  .login-panel { padding: 32px 16px; }
  .login-welcome { font-size: 22px; }
}

/* ---- Very narrow (320px, folded devices) ------------------------- */
@media (max-width: 340px) {
  .stats-grid { grid-template-columns: 1fr; }
  .btn { padding: 10px 12px; }
}

/* ---- Landscape phones: reclaim vertical space -------------------- */
@media (max-height: 480px) and (orientation: landscape) {
  .login-panel { align-items: flex-start; padding-top: 24px; padding-bottom: 24px; }
  .login-welcome { font-size: 21px; }
  .login-sub { margin-bottom: 18px; }
  .sidebar-brand { padding: 12px 16px 10px; }
  .sidebar-logo { width: 34px; height: 34px; }
  .dlg-overlay { align-items: center; }
  .dlg-box { max-height: 92vh; overflow-y: auto; }
}

/* ---- Pointer-quality tweaks -------------------------------------- */
@media (hover: none) {
  /* Hover lifts feel like lag on touch devices. */
  .stat-card:hover { transform: none; box-shadow: var(--sh-sm); }
  tbody tr:hover td { background: transparent; }
}

/* ------------------------------------------------------------------ *
 * 20. Motion & print
 * ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  .sidebar, .sidebar-backdrop, .topbar, .no-print, .btn-group.no-print { display: none !important; }
  .main-content { margin: 0; padding: 0; max-width: none; }
  body { background: #fff; }
  .card { border: none; box-shadow: none; }
  .inv-table th { background: #1f2937 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ------------------------------------------------------------------ *
 * 21. app2 additions — reports, statements, numeric tables
 *     (kept at the end so they layer over the shared base above;
 *      no existing rule or class name is modified)
 * ------------------------------------------------------------------ */

/* Right-aligned numeric cells used across every report / listing table. */
.tr, td.tr, th.tr { text-align: right; }
.font-mono, .tr, td.tr { white-space: nowrap; }
.responsive-table thead th:last-child { text-align: right; }

/* Report hub tab strips — scroll horizontally rather than wrapping into a
   tall block on narrow phones. */
.rep-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
@media (max-width: 560px) {
  .rep-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .rep-tabs::-webkit-scrollbar { display: none; }
  .rep-tabs > .btn { flex: 0 0 auto; }
}

/* Report filter bar — reuses the responsive .orders-filter grid, with a
   couple of report-only affordances layered on top. */
.orders-filter .ff-actions .btn { white-space: nowrap; }
.orders-filter .ff-wide { flex: 1 1 220px; min-width: 180px; }

/* Active-filter chips shown above a report's table. */
.rep-filter-note {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 12.5px;
  color: var(--muted);
}
.rep-filter-note .chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-l);
  color: var(--brand-d);
  border: 1px solid var(--brand-ring);
  font-weight: 600;
  font-size: 12px;
}

/* WhatsApp share button — brand colour is fixed by WhatsApp, so it is the
   one button that intentionally sits outside the Appsoware palette. */
.btn-whatsapp { background: #25D366; color: #fff; border-color: #25D366; }
.btn-whatsapp:hover { background: #1ebe5b; border-color: #1ebe5b; color: #fff; }

/* Very small phones (iPhone SE / 320px): keep report action rows usable. */
@media (max-width: 380px) {
  .btn-group { flex-wrap: wrap; }
  .btn-group > .btn { flex: 1 1 100%; justify-content: center; }
  .orders-filter .ff select,
  .orders-filter .ff input[type=date] { min-width: 0; width: 100%; }
}
