/* ============================================================
   PawTrack - Main Stylesheet
   Island Paws Veterinary Services | San Juan, Siquijor
   Color Theme: Shades of Green
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=DM+Serif+Display:ital@0;1&display=swap');

/* ── CSS Variables ── */
:root {
  /* Green Palette */
  --green-950: #052e16;
  --green-900: #14532d;
  --green-800: #166534;
  --green-700: #15803d;
  --green-600: #16a34a;
  --green-500: #22c55e;
  --green-400: #4ade80;
  --green-300: #86efac;
  --green-200: #bbf7d0;
  --green-100: #dcfce7;
  --green-50:  #f0fdf4;

  /* Neutrals */
  --white:      #ffffff;
  --gray-50:    #f8fafc;
  --gray-100:   #f1f5f9;
  --gray-200:   #e2e8f0;
  --gray-300:   #cbd5e1;
  --gray-400:   #94a3b8;
  --gray-500:   #64748b;
  --gray-600:   #475569;
  --gray-700:   #334155;
  --gray-800:   #1e293b;
  --gray-900:   #0f172a;

  /* Semantic */
  --primary:        var(--green-700);
  --primary-dark:   var(--green-800);
  --primary-light:  var(--green-600);
  --primary-pale:   var(--green-50);
  --accent:         var(--green-400);

  --danger:  #ef4444;
  --warning: #f59e0b;
  --info:    #3b82f6;
  --success: var(--green-600);

  /* Typography */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'Plus Jakarta Sans', system-ui, sans-serif;

  /* Spacing */
  --sidebar-w: 260px;
  --topbar-h:  64px;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 12px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.10), 0 4px 12px rgba(0,0,0,.06);

  /* Transitions */
  --ease: .2s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: .9375rem;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }

/* ── Layout ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--green-950);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 200;
  transition: transform var(--ease);
  overflow-y: auto;
}

.sidebar-brand {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-icon {
  width: 42px; height: 42px;
  background: var(--green-600);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.brand-text .brand-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--white);
  line-height: 1.2;
}
.brand-text .brand-sub {
  font-size: .68rem;
  color: var(--green-300);
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}
.nav-section-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--green-400);
  padding: 12px 12px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--green-200);
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--ease);
  cursor: pointer;
  margin-bottom: 2px;
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: var(--white);
}
.nav-item.active {
  background: var(--green-700);
  color: var(--white);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--green-400);
  border-radius: 0 3px 3px 0;
}
.nav-icon {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.nav-badge {
  margin-left: auto;
  background: var(--green-500);
  color: var(--green-950);
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--ease);
}
.sidebar-user:hover { background: rgba(255,255,255,.07); }
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--green-700);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
}
.user-info .user-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--white);
  line-height: 1.2;
}
.user-info .user-role {
  font-size: .68rem;
  color: var(--green-400);
}

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--green-900);
  flex: 1;
}
.topbar-title span {
  font-size: .8rem;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--gray-400);
  display: block;
  margin-top: -2px;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  color: var(--gray-600);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: all var(--ease);
  position: relative;
}
.topbar-btn:hover {
  background: var(--green-50);
  color: var(--green-700);
}
.topbar-notif {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--white);
}
.menu-toggle {
  display: none;
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  color: var(--gray-600);
  align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ── Page Content ── */
.page-content {
  padding: 28px;
  flex: 1;
}
.page-section { display: none; }
.page-section.active { display: block; }

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header-text .page-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--green-900);
  line-height: 1.2;
}
.page-header-text .page-desc {
  font-size: .875rem;
  color: var(--gray-500);
  margin-top: 4px;
}
.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: box-shadow var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon.green  { background: var(--green-100); color: var(--green-700); }
.stat-icon.teal   { background: #e0f2fe;           color: #0284c7; }
.stat-icon.amber  { background: #fef3c7;           color: #d97706; }
.stat-icon.red    { background: #fee2e2;           color: #dc2626; }
.stat-info .stat-val {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}
.stat-info .stat-label {
  font-size: .8rem;
  color: var(--gray-500);
  font-weight: 500;
  margin-top: 4px;
}
.stat-info .stat-delta {
  font-size: .75rem;
  font-weight: 600;
  margin-top: 6px;
}
.stat-delta.up   { color: var(--green-600); }
.stat-delta.down { color: var(--danger); }

/* ── Cards / Panels ── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-title {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--gray-800);
}
.card-body { padding: 22px; }
.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--ease);
  white-space: nowrap;
  border: 1.5px solid transparent;
}
.btn-sm   { padding: 6px 14px; font-size: .8rem; }
.btn-lg   { padding: 12px 24px; font-size: 1rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; }
.btn-primary {
  background: var(--green-700);
  color: var(--white);
  border-color: var(--green-700);
}
.btn-primary:hover {
  background: var(--green-800);
  border-color: var(--green-800);
  box-shadow: 0 4px 12px rgba(21,128,61,.25);
}
.btn-outline {
  background: transparent;
  color: var(--green-700);
  border-color: var(--green-700);
}
.btn-outline:hover {
  background: var(--green-50);
}
.btn-ghost {
  background: var(--gray-100);
  color: var(--gray-600);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--gray-200); color: var(--gray-800); }
.btn-danger {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}
.btn-danger:hover { background: #dc2626; }
.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  font-family: var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  border: 1.5px solid var(--danger);
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  transition: all var(--ease);
}
.btn-logout:hover {
  background: var(--danger);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(239,68,68,.25);
}
.btn-warning {
  background: var(--warning);
  color: var(--white);
  border-color: var(--warning);
}

/* ── Table ── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
thead th {
  background: var(--green-900);
  color: var(--green-200);
  padding: 12px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--ease);
}
tbody tr:hover { background: var(--green-50); }
tbody td {
  padding: 13px 16px;
  color: var(--gray-700);
  vertical-align: middle;
}
tbody tr:last-child { border-bottom: none; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .03em;
}
.badge-success  { background: var(--green-100); color: var(--green-800); }
.badge-danger   { background: #fee2e2;           color: #991b1b; }
.badge-warning  { background: #fef3c7;           color: #92400e; }
.badge-info     { background: #dbeafe;           color: #1e40af; }
.badge-neutral  { background: var(--gray-100);   color: var(--gray-600); }

/* ── Forms ── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-700);
}
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-family: var(--font-body);
  color: var(--gray-800);
  background: var(--white);
  transition: border-color var(--ease), box-shadow var(--ease);
  outline: none;
}
.form-control:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(34,197,94,.15);
}
.form-control::placeholder { color: var(--gray-400); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.form-hint { font-size: .75rem; color: var(--gray-400); }

/* Visible "From" / "To" labels for date-range filters (Sales History,
   Stock In, Stock Out). An empty <input type="date"> shows no
   placeholder text on mobile Chrome, so without this label the field
   just looks like an empty, unlabeled box. */
.date-filter-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--gray-500);
  white-space: nowrap;
}
@media (max-width: 620px) {
  .date-filter-label { padding-top: 4px; }
}
.form-error { font-size: .75rem; color: var(--danger); }

/* ── Searchable product dropdown (barcode generator, etc.) ── */
#card-generate-barcode { overflow: visible; }
.bc-product-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 30;
  margin-top: 4px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.bc-product-dropdown.open { display: block; }
.bc-product-option {
  padding: 9px 13px;
  font-size: .875rem;
  color: var(--gray-800);
  cursor: pointer;
}
.bc-product-option:hover,
.bc-product-option.active { background: var(--gray-50); }
.bc-product-option .bc-product-code {
  display: block;
  font-size: .75rem;
  color: var(--gray-400);
  font-family: monospace;
}
.bc-product-empty {
  padding: 12px 13px;
  font-size: .8rem;
  color: var(--gray-400);
  text-align: center;
}

/* ── Search Bar ── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  transition: border-color var(--ease);
}
.search-bar:focus-within {
  background: var(--white);
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(34,197,94,.12);
}
.search-bar input {
  border: none;
  background: none;
  outline: none;
  font-size: .875rem;
  color: var(--gray-800);
  width: 220px;
}
.search-bar input::placeholder { color: var(--gray-400); }
.search-bar .search-icon { color: var(--gray-400); font-size: .9rem; }

/* ── Toolbar ── */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease;
}
.modal-lg { max-width: 760px; }
@keyframes modalIn {
  from { transform: translateY(16px) scale(.97); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.modal-header {
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--green-900);
}
.modal-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--gray-500);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  transition: all var(--ease);
}
.modal-close:hover { background: var(--gray-200); color: var(--gray-800); }
.modal-body { padding: 24px 26px; }
.modal-footer {
  padding: 18px 26px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

/* ── Charts Placeholder ── */
.chart-placeholder {
  height: 220px;
  background: linear-gradient(135deg, var(--green-50) 0%, var(--green-100) 100%);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--green-600);
  font-size: .875rem;
  font-weight: 500;
}
.chart-placeholder .chart-icon { font-size: 2.5rem; opacity: .5; }

/* ── Dashboard Grid ── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.dash-grid .span-2 { grid-column: span 2; }

/* ── Quick Activity ── */
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 7px;
  flex-shrink: 0;
}
.activity-dot.green  { background: var(--green-500); }
.activity-dot.amber  { background: var(--warning); }
.activity-dot.red    { background: var(--danger); }
.activity-dot.blue   { background: var(--info); }
.activity-text { font-size: .8rem; color: var(--gray-700); line-height: 1.5; }
.activity-time { font-size: .72rem; color: var(--gray-400); margin-top: 2px; }

/* ── Low Stock Alert ── */
.alert-strip {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-left: 4px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: .8rem;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-top: 1px solid var(--gray-100);
  flex-wrap: wrap;
  gap: 10px;
}
.pagination-info { font-size: .8rem; color: var(--gray-500); }
.pagination-pages { display: flex; gap: 4px; }
.page-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-600);
  background: var(--gray-100);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--ease);
}
.page-btn:hover      { background: var(--green-100); color: var(--green-700); }
.page-btn.active     { background: var(--green-700); color: var(--white); }
.page-btn.disabled   { opacity: .4; pointer-events: none; }

/* ── Barcode Display ── */
.barcode-card {
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.barcode-card:hover {
  border-color: var(--green-400);
  box-shadow: var(--shadow);
}
.barcode-img-wrap {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  font-size: 3rem;
  line-height: 1;
}
.barcode-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--gray-700);
}
.barcode-code {
  font-size: .72rem;
  color: var(--gray-400);
  font-family: monospace;
  margin-top: 2px;
}

/* ── Barcodes Grid ── */
.barcodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}

/* ── Reports ── */
.report-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
}
.report-row:last-child { border-bottom: none; }
.report-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: var(--green-100);
  color: var(--green-700);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.report-info .report-name { font-size: .875rem; font-weight: 600; color: var(--gray-800); }
.report-info .report-desc { font-size: .75rem; color: var(--gray-400); }
.report-actions { margin-left: auto; display: flex; gap: 6px; }

/* ── Scrollbar ── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-300); }

/* ── Sidebar Overlay (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 190;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-grid .span-2 { grid-column: span 1; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }

  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open { display: block; }

  .main-content { margin-left: 0; }

  .menu-toggle { display: flex; }

  .page-content { padding: 16px; }

  .topbar { padding: 0 16px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  .stat-card { padding: 16px; gap: 12px; }
  .stat-icon { width: 44px; height: 44px; font-size: 1.2rem; }
  .stat-info .stat-val { font-size: 1.4rem; }

  .page-header { flex-direction: column; }
  .page-header-actions { width: 100%; }

  .table-toolbar { flex-direction: column; align-items: flex-start; }
  .search-bar input { width: 160px; }

  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1; }

  .modal { border-radius: var(--radius-lg); }
  .modal-lg { max-width: 100%; }

  .barcodes-grid { grid-template-columns: repeat(2, 1fr); }

  .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar-title span { display: none; }
  .barcodes-grid { grid-template-columns: 1fr 1fr; }
  .pagination { flex-direction: column; align-items: flex-start; }

  .search-bar { width: 100%; }
  .search-bar input { width: 100%; }

  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; justify-content: center; }

  .card-header { padding: 14px 16px; }
  .card-body { padding: 16px; }
}

/* ── Report / Filter Pill Tabs (Reports, Expiration, etc.) ── */
.exp-filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.exp-filter-tab {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-600);
  cursor: pointer;
  user-select: none;
  transition: all var(--ease);
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.exp-filter-tab:hover { background: var(--gray-200); }
.exp-filter-tab.active {
  background: var(--green-700);
  color: var(--white);
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — User Management (Owner)
   Scoped to #section-users and its modals so no other
   module/page is affected.
   ══════════════════════════════════════════════════════════ */

/* Header actions stack full-width on small phones, same
   pattern already used for .modal-footer .btn */
@media (max-width: 480px) {
  #section-users .page-header-actions { flex-direction: column; }
  #section-users .page-header-actions .btn { width: 100%; justify-content: center; }
}

/* Toolbar: search + role/status filters stack and become
   full-width, tap-friendly controls instead of shrink-wrapping */
@media (max-width: 620px) {
  #section-users .table-toolbar,
  #modalActivityLog .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  #section-users .table-toolbar > div:first-child,
  #modalActivityLog .table-toolbar > div:first-child {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  #section-users #usersFilterRole,
  #section-users #usersFilterStatus,
  #modalActivityLog #logFilterUser {
    width: 100% !important;
  }
  #section-users .search-bar,
  #modalActivityLog .search-bar { width: 100%; }
  #section-users .search-bar input,
  #modalActivityLog .search-bar input { width: 100%; }
  #section-users #usersCount { margin-top: 2px; }
}

/* Users table & Activity Log table: switch from a horizontally-
   scrolling grid to stacked "cards" on narrow screens so nothing
   gets clipped and every value stays fully readable/tappable. */
@media (max-width: 680px) {
  #section-users #usersTable thead,
  #modalActivityLog #activityLogTable thead {
    display: none;
  }
  #section-users #usersTable,
  #section-users #usersTable tbody,
  #section-users #usersTable tr,
  #section-users #usersTable td,
  #modalActivityLog #activityLogTable,
  #modalActivityLog #activityLogTable tbody,
  #modalActivityLog #activityLogTable tr,
  #modalActivityLog #activityLogTable td {
    display: block;
    width: 100%;
  }
  #section-users #usersTable tbody tr,
  #modalActivityLog #activityLogTable tbody tr {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 4px 14px;
    margin-bottom: 12px;
  }
  #section-users #usersTable tbody tr:hover,
  #modalActivityLog #activityLogTable tbody tr:hover { background: var(--white); }
  #section-users #usersTable tbody tr:last-child,
  #modalActivityLog #activityLogTable tbody tr:last-child { margin-bottom: 0; }

  #section-users #usersTable td,
  #modalActivityLog #activityLogTable td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    text-align: right;
    border-bottom: 1px dashed var(--gray-100);
    white-space: normal;
  }
  #section-users #usersTable td:last-child,
  #modalActivityLog #activityLogTable td:last-child { border-bottom: none; }

  #section-users #usersTable td[data-label]::before,
  #modalActivityLog #activityLogTable td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--gray-400);
    text-align: left;
  }

  /* Loading / empty / error rows: plain centered block, no card chrome */
  #section-users #usersTable td[colspan],
  #modalActivityLog #activityLogTable td[colspan] {
    display: block;
    text-align: center;
    border-bottom: none;
  }

  /* Actions column: label on its own line, buttons wrap left-aligned */
  #section-users #usersTable td[data-label="Actions"] {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  #section-users #usersTable td[data-label="Actions"] > div {
    justify-content: flex-start;
  }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — Inventory Management (Owner)
   Scoped to #section-inventory and its modals so no other
   module/page is affected.
   ══════════════════════════════════════════════════════════ */

/* Header actions (Export CSV / History / + Add Product) stack
   full-width on small phones, same pattern already used for
   .modal-footer .btn and the Users page-header-actions */
@media (max-width: 560px) {
  #section-inventory .page-header-actions { flex-direction: column; }
  #section-inventory .page-header-actions .btn { width: 100%; justify-content: center; }
}

/* Toolbar: search + category/status filters stack and become
   full-width, tap-friendly controls instead of shrink-wrapping */
@media (max-width: 620px) {
  #section-inventory .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  #section-inventory .table-toolbar > div:first-child {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  #section-inventory #invFilterCat,
  #section-inventory #invFilterStatus {
    width: 100% !important;
  }
  #section-inventory .search-bar { width: 100%; }
  #section-inventory .search-bar input { width: 100%; }
  #section-inventory #invCount { margin-top: 2px; }
}

/* History modal filter row: same stacking treatment as the main toolbar */
@media (max-width: 560px) {
  #modalInvHistory .modal-body > div:first-child {
    flex-direction: column;
    align-items: stretch;
  }
  #modalInvHistory #histFilterProd,
  #modalInvHistory #histFilterType,
  #modalInvHistory #btnRefreshHistory { width: 100%; }
}

/* Inventory table & Inventory History table: switch from a
   horizontally-scrolling grid to stacked "cards" on narrow screens
   so nothing gets clipped and every value stays fully readable. */
@media (max-width: 760px) {
  #inventoryTable thead,
  #modalInvHistory table thead {
    display: none;
  }
  #inventoryTable,
  #inventoryTable tbody,
  #inventoryTable tr,
  #inventoryTable td,
  #modalInvHistory table,
  #modalInvHistory table tbody,
  #modalInvHistory table tr,
  #modalInvHistory table td {
    display: block;
    width: 100%;
  }
  #inventoryTable tbody tr,
  #modalInvHistory table tbody tr {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 4px 14px;
    margin-bottom: 12px;
  }
  #inventoryTable tbody tr:hover,
  #modalInvHistory table tbody tr:hover { background: var(--white); }
  #inventoryTable tbody tr:last-child,
  #modalInvHistory table tbody tr:last-child { margin-bottom: 0; }

  #inventoryTable td,
  #modalInvHistory table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    text-align: right;
    border-bottom: 1px dashed var(--gray-100);
    white-space: normal;
  }
  #inventoryTable td:last-child,
  #modalInvHistory table td:last-child { border-bottom: none; }

  #inventoryTable td[data-label]::before,
  #modalInvHistory table td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--gray-400);
    text-align: left;
  }

  /* Loading / empty / error rows: plain centered block, no card chrome */
  #inventoryTable td[colspan],
  #modalInvHistory table td[colspan] {
    display: block;
    text-align: center;
    border-bottom: none;
  }

  /* Product Name / Stock cells wrap multi-line content in their own
     container so it stacks under the label instead of squeezing
     next to it */
  #inventoryTable td[data-label="Product Name"],
  #inventoryTable td[data-label="Stock"] {
    align-items: flex-start;
    text-align: right;
  }

  /* Actions column: label on its own line, buttons wrap left-aligned */
  #inventoryTable td[data-label="Actions"] {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  #inventoryTable td[data-label="Actions"] > div {
    justify-content: flex-start !important;
  }
}

/* Small phones: keep the Adjust-Stock "Current / After" preview
   columns from crowding each other */
@media (max-width: 380px) {
  #modalAdjStock div[style*="gap:32px"] {
    gap: 18px !important;
  }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — Barcode Management (Owner)
   Scoped to #section-barcodes and its modals so no other
   module/page is affected.
   ══════════════════════════════════════════════════════════ */

/* Tab nav (Generate / Assign / Records / Settings): scroll
   horizontally instead of overflowing the page or squeezing
   labels when all four tabs don't fit on narrow screens */
@media (max-width: 640px) {
  #bcTabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  #bcTabs::-webkit-scrollbar { display: none; }
  #bcTabs .bc-tab { flex-shrink: 0; }
}

/* Generator "Product / Format / Generate" row already collapses
   via .form-grid, but the Preview card's action row (Select All /
   Print Selected / Download) and the Assign tab's header button
   need to wrap onto their own line instead of crowding the title */
@media (max-width: 560px) {
  #bc-generate .card-header,
  #bc-assign .card-header {
    flex-wrap: wrap;
    row-gap: 10px;
  }
  #bc-generate .card-header > div {
    width: 100%;
  }
  #bc-generate .card-header > div .btn { flex: 1; }
  #bc-assign #btnBulkAssign { width: 100%; justify-content: center; }
}

/* Records tab toolbar: search + format filter stack and become
   full-width, tap-friendly controls instead of shrink-wrapping */
@media (max-width: 620px) {
  #section-barcodes .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  #section-barcodes .table-toolbar > div:first-child {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  #section-barcodes #bcRecordFilterFormat { width: 100% !important; }
  #section-barcodes .search-bar { width: 100%; }
  #section-barcodes .search-bar input { width: 100%; }
  #section-barcodes #bcRecordCount { margin-top: 2px; }
}

/* Assign-to-Products table & Barcode Records table: switch from a
   horizontally-scrolling grid to stacked "cards" on narrow screens
   so nothing gets clipped and every value stays fully readable. */
@media (max-width: 760px) {
  #assignTable thead,
  #bcRecordTable thead {
    display: none;
  }
  #assignTable, #assignTable tbody, #assignTable tr, #assignTable td,
  #bcRecordTable, #bcRecordTable tbody, #bcRecordTable tr, #bcRecordTable td {
    display: block;
    width: 100%;
  }
  #assignTable tbody tr,
  #bcRecordTable tbody tr {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 4px 14px;
    margin-bottom: 12px;
  }
  #assignTable tbody tr:hover,
  #bcRecordTable tbody tr:hover { background: var(--white); }
  #assignTable tbody tr:last-child,
  #bcRecordTable tbody tr:last-child { margin-bottom: 0; }

  #assignTable td,
  #bcRecordTable td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    text-align: right;
    border-bottom: 1px dashed var(--gray-100);
    white-space: normal;
  }
  #assignTable td:last-child,
  #bcRecordTable td:last-child { border-bottom: none; }

  #assignTable td[data-label]::before,
  #bcRecordTable td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--gray-400);
    text-align: left;
  }

  /* Loading / empty / error rows: plain centered block, no card chrome */
  #assignTable td[colspan],
  #bcRecordTable td[colspan] {
    display: block;
    text-align: center;
    border-bottom: none;
  }

  /* Action columns: label on its own line, buttons wrap left-aligned */
  #assignTable td[data-label="Action"],
  #bcRecordTable td[data-label="Actions"] {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  #assignTable td[data-label="Action"] > div,
  #bcRecordTable td[data-label="Actions"] > div {
    justify-content: flex-start !important;
  }

  /* Preview swatch: keep it beside its label rather than stretching */
  #bcRecordTable td[data-label="Preview"] { align-items: center; }
}

/* Settings tab: its inline grid uses minmax(340px,1fr), which is
   wider than the viewport on small phones and would otherwise
   force horizontal overflow. Drop it to a single column there. */
@media (max-width: 400px) {
  #bc-settings > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — Sales (Owner)
   Scoped to #section-sales and its modal so no other
   module/page is affected.
   ══════════════════════════════════════════════════════════ */

/* Header actions (Export) stack full-width on small phones,
   same pattern already used for Users / Inventory */
@media (max-width: 480px) {
  #section-sales .page-header-actions { flex-direction: column; }
  #section-sales .page-header-actions .btn { width: 100%; justify-content: center; }
}

/* New Sale terminal: barcode input / qty / Add to Cart button
   become full-width, tap-friendly controls instead of shrinking
   and wrapping unevenly on narrow screens */
@media (max-width: 560px) {
  #section-sales .sale-scan-row {
    align-items: stretch;
  }
  #section-sales .sale-scan-row .form-group {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  #section-sales .sale-scan-row .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Cart total / Clear / Complete Sale row: wrap and let the total
   take its own full-width line so the action buttons stay
   comfortably tappable */
@media (max-width: 480px) {
  #section-sales .sale-cart-footer {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  #section-sales .sale-cart-footer-label,
  #section-sales #saleCartTotal {
    flex: 1 1 auto;
  }
  #section-sales .sale-cart-footer .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* Sales History toolbar: search + date range + Apply stack and
   become full-width, tap-friendly controls instead of
   shrink-wrapping, same pattern already used elsewhere */
@media (max-width: 620px) {
  #section-sales .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  #section-sales .search-bar { width: 100%; }
  #section-sales .search-bar input { width: 100%; }
  #section-sales .sale-hist-filters {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  #section-sales .sale-hist-filters input,
  #section-sales .sale-hist-filters .btn { width: 100% !important; }
}

/* Cart & Sales History tables: switch from a horizontally-
   scrolling grid to stacked "cards" on narrow screens so nothing
   gets clipped and every value stays fully readable/tappable. */
@media (max-width: 760px) {
  #saleCartTable thead,
  #salesHistTable thead {
    display: none;
  }
  #saleCartTable, #saleCartTable tbody, #saleCartTable tr, #saleCartTable td,
  #salesHistTable, #salesHistTable tbody, #salesHistTable tr, #salesHistTable td {
    display: block;
    width: 100%;
  }
  #saleCartTable tbody tr,
  #salesHistTable tbody tr {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 4px 14px;
    margin-bottom: 12px;
  }
  #saleCartTable tbody tr:hover,
  #salesHistTable tbody tr:hover { background: var(--white); }
  #saleCartTable tbody tr:last-child,
  #salesHistTable tbody tr:last-child { margin-bottom: 0; }

  #saleCartTable td,
  #salesHistTable td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    text-align: right;
    border-bottom: 1px dashed var(--gray-100);
    white-space: normal;
  }
  #saleCartTable td:last-child,
  #salesHistTable td:last-child { border-bottom: none; }

  #saleCartTable td[data-label]::before,
  #salesHistTable td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--gray-400);
    text-align: left;
  }

  /* Loading / empty rows: plain centered block, no card chrome */
  #saleCartTable td[colspan],
  #salesHistTable td[colspan] {
    display: block;
    text-align: center;
    border-bottom: none;
  }

  /* Product cell (name + barcode) wraps under its own label
     instead of squeezing beside it */
  #saleCartTable td[data-label="Product"] {
    align-items: flex-start;
    text-align: right;
  }

  /* Keep the quantity stepper a sensible width instead of
     stretching edge-to-edge */
  #saleCartTable td[data-label="Qty"] input { width: 90px; }

  /* Items summary in history: let it wrap under its label instead
     of truncating with an ellipsis, since there's no cramped
     column width to protect on a stacked card */
  #salesHistTable td[data-label="Items"] {
    align-items: flex-start;
    text-align: right;
    max-width: none !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — Stock Transactions (Owner)
   Scoped to #section-transactions and #modalTrxDetail so no
   other module/page is affected.
   ══════════════════════════════════════════════════════════ */

/* Header actions (Export) stack full-width on small phones,
   same pattern already used for Users / Inventory / Sales */
@media (max-width: 480px) {
  #section-transactions .page-header-actions { flex-direction: column; }
  #section-transactions .page-header-actions .btn { width: 100%; justify-content: center; }
}

/* Tab nav (Stock In / Stock Out / Item Usage): scroll horizontally
   instead of overflowing the page or squeezing labels when all
   three tabs don't fit on narrow screens. Width/background are set
   inline (by markup and by switchTrxTab()), so overrides here that
   fight an inline value need !important. */
@media (max-width: 480px) {
  #section-transactions .trx-tab-nav {
    width: 100% !important;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  #section-transactions .trx-tab-nav::-webkit-scrollbar { display: none; }
  #section-transactions .trx-tab-btn { flex-shrink: 0; }
}

/* Stock In / Stock Out toolbars: search + date range + Apply, and
   the Item Usage toolbar: search + period select + Export Usage —
   all stack into full-width, tap-friendly controls instead of
   shrink-wrapping. Date/period widths are set inline (width:auto),
   so need !important to override. */
@media (max-width: 620px) {
  #section-transactions .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  #section-transactions .table-toolbar > div:last-child {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  #section-transactions #siDateFrom,
  #section-transactions #siDateTo,
  #section-transactions #soDateFrom,
  #section-transactions #soDateTo,
  #section-transactions #usagePeriod {
    width: 100% !important;
  }
  #section-transactions .table-toolbar > div:last-child .btn { width: 100%; justify-content: center; }
  #section-transactions .search-bar { width: 100%; }
  #section-transactions .search-bar input { width: 100%; }
}

/* Stock-In, Stock-Out and Item Usage tables: switch from a
   horizontally-scrolling grid to stacked "cards" on narrow screens
   so nothing gets clipped and every value stays fully readable,
   same pattern already used for Inventory / Barcodes / Sales. */
@media (max-width: 760px) {
  #stockInTable thead,
  #stockOutTable thead,
  #usageTable thead {
    display: none;
  }
  #stockInTable, #stockInTable tbody, #stockInTable tr, #stockInTable td,
  #stockOutTable, #stockOutTable tbody, #stockOutTable tr, #stockOutTable td,
  #usageTable, #usageTable tbody, #usageTable tr, #usageTable td {
    display: block;
    width: 100%;
  }
  #stockInTable tbody tr,
  #stockOutTable tbody tr,
  #usageTable tbody tr {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 4px 14px;
    margin-bottom: 12px;
  }
  #stockInTable tbody tr:hover,
  #stockOutTable tbody tr:hover,
  #usageTable tbody tr:hover { background: var(--white); }
  #stockInTable tbody tr:last-child,
  #stockOutTable tbody tr:last-child,
  #usageTable tbody tr:last-child { margin-bottom: 0; }

  #stockInTable td,
  #stockOutTable td,
  #usageTable td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    text-align: right;
    border-bottom: 1px dashed var(--gray-100);
    white-space: normal;
  }
  #stockInTable td:last-child,
  #stockOutTable td:last-child,
  #usageTable td:last-child { border-bottom: none; }

  #stockInTable td[data-label]::before,
  #stockOutTable td[data-label]::before,
  #usageTable td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--gray-400);
    text-align: left;
  }

  /* Loading / empty rows: plain centered block, no card chrome */
  #stockInTable td[colspan],
  #stockOutTable td[colspan],
  #usageTable td[colspan] {
    display: block;
    text-align: center;
    border-bottom: none;
  }

  /* Product cell wraps multi-line content under its own label
     instead of squeezing next to it */
  #stockInTable td[data-label="Product"],
  #stockOutTable td[data-label="Product"],
  #usageTable td[data-label="Product"] {
    align-items: flex-start;
    text-align: right;
  }
}

/* Transaction Detail modal: the label/value table uses a fixed
   160px label column via inline width, which is comfortable on
   desktop but crowds the value on small phones. Narrow it so both
   columns stay readable without wrapping awkwardly. */
@media (max-width: 480px) {
  #modalTrxDetail #trxDetailBody td[style*="width:160px"] {
    width: 108px !important;
    font-size: .76rem !important;
  }
}

/* ══════════════════════════════════════════════════════════
   REPORTS (Owner) — Base Layout Fix
   .report-filter-group has no base display rule anywhere else
   in this file; the reports.js tab-switcher only sets
   display:flex on it once a tab is clicked, so the initially-
   active group (Inventory) renders unstyled block until then.
   Defining it here makes all three filter groups lay out as a
   wrapping row from first load, matching the toolbar row style
   already used by every other module — this is what the
   responsive rules below build on.
   ══════════════════════════════════════════════════════════ */
.report-filter-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — Reports (Owner)
   Scoped to #section-reports so no other module/page is
   affected.
   ══════════════════════════════════════════════════════════ */

/* Header actions (Refresh / Export CSV / Print) stack full-width
   on small phones — three buttons need the room sooner than the
   two-button headers elsewhere, same pattern as Inventory. */
@media (max-width: 560px) {
  #section-reports .page-header-actions { flex-direction: column; }
  #section-reports .page-header-actions .btn { width: 100%; justify-content: center; }
}

/* Toolbar: search + per-report-type filters (category/status,
   format, expiry window) stack and become full-width, tap-friendly
   controls instead of shrink-wrapping */
@media (max-width: 620px) {
  #section-reports .report-filter-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  #section-reports #repInvCategory,
  #section-reports #repInvStatus,
  #section-reports #repBcFormat,
  #section-reports #repExpWindow {
    width: 100% !important;
  }
  #section-reports .search-bar { width: 100%; }
  #section-reports .search-bar input { width: 100%; }
}

/* Inventory / Barcode / Expiration report tables: switch from a
   horizontally-scrolling grid to stacked "cards" on narrow screens
   so nothing gets clipped and every value stays fully readable,
   same pattern already used for Inventory / Sales / Transactions /
   Users. Scoped to the on-screen table inside #reportPrintArea so
   the print stylesheet (which restores a real <table> layout) is
   left untouched. */
@media screen and (max-width: 760px) {
  #section-reports .report-table table thead { display: none; }
  #section-reports .report-table table,
  #section-reports .report-table table tbody,
  #section-reports .report-table table tr,
  #section-reports .report-table table td {
    display: block;
    width: 100%;
  }
  #section-reports .report-table table tbody tr {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 4px 14px;
    margin-bottom: 12px;
  }
  #section-reports .report-table table tbody tr:hover { background: var(--white); }
  #section-reports .report-table table tbody tr:last-child { margin-bottom: 0; }

  #section-reports .report-table table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    text-align: right;
    border-bottom: 1px dashed var(--gray-100);
    white-space: normal;
  }
  #section-reports .report-table table td:last-child { border-bottom: none; }

  #section-reports .report-table table td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--gray-400);
    text-align: left;
  }

  /* Loading / empty / error rows: plain centered block, no card chrome */
  #section-reports .report-table table td[colspan] {
    display: block;
    text-align: center;
    border-bottom: none;
  }

  /* Product Name cell wraps under its own label instead of
     squeezing beside it (mirrors the Inventory module's table) */
  #section-reports .report-table table td[data-label="Product Name"] {
    align-items: flex-start;
    text-align: right;
  }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — Dashboard (Owner)
   Scoped to #section-dashboard so no other module/page is
   affected.
   ══════════════════════════════════════════════════════════ */

/* Header actions (Refresh / + Add Product) stack full-width
   on small phones, same pattern already used for Sales /
   Transactions */
@media (max-width: 480px) {
  #section-dashboard .page-header-actions { flex-direction: column; }
  #section-dashboard .page-header-actions .btn { width: 100%; justify-content: center; }
}

/* Low Stock Alert Strip: let the icon sit at the top instead of
   dead-center once the message wraps to multiple lines on
   narrow screens */
@media (max-width: 480px) {
  #dashAlertStrip { align-items: flex-start; }
}

/* Inventory Summary table: switch from a horizontally-scrolling
   grid to stacked "cards" on narrow screens so nothing gets
   clipped and every value stays fully readable, same pattern
   already used for Inventory / Sales / Transactions / Reports /
   Users. */
@media (max-width: 760px) {
  #dashSummaryTable thead { display: none; }
  #dashSummaryTable,
  #dashSummaryTable tbody,
  #dashSummaryTable tr,
  #dashSummaryTable td {
    display: block;
    width: 100%;
  }
  #dashSummaryTable tbody tr {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 4px 14px;
    margin-bottom: 12px;
  }
  #dashSummaryTable tbody tr:hover { background: var(--white); }
  #dashSummaryTable tbody tr:last-child { margin-bottom: 0; }

  #dashSummaryTable td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    text-align: right;
    border-bottom: 1px dashed var(--gray-100);
    white-space: normal;
  }
  #dashSummaryTable td:last-child { border-bottom: none; }

  #dashSummaryTable td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--gray-400);
    text-align: left;
  }

  /* Loading / empty / error rows: plain centered block, no card chrome */
  #dashSummaryTable td[colspan] {
    display: block;
    text-align: center;
    border-bottom: none;
  }

  /* Product cell wraps under its own label instead of squeezing
     beside it (mirrors the Inventory module's table) */
  #dashSummaryTable td[data-label="Product"] {
    align-items: flex-start;
    text-align: right;
  }
}

/* Recent Activities / Low Stock / Expiry Alerts: the two-line
   text + timestamp already wraps naturally, but on very small
   phones give the leading status dot a touch more top margin so
   it stays aligned with the first line once text wraps to 3+
   lines */
@media (max-width: 380px) {
  #section-dashboard .activity-dot { margin-top: 5px; }
}

