:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-muted: #f8fafc;
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --text: #334155;
  --text-secondary: #475569;
  --muted: #64748b;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-darker: #1d4ed8;
  --primary-light: #dbeafe;
  --primary-soft: #eff6ff;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: #eff6ff;
  --success: #10b981;
  --success-soft: #ecfdf5;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --sidebar-width: 272px;
  --radius: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.06), 0 2px 4px -2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,.08), 0 8px 10px -6px rgba(0,0,0,.04);
  --transition: .2s cubic-bezier(.4,0,.2,1);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}

a, button, input, select, textarea, .btn, .nav-link, .tab, .product-tile, .payment-option {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(59, 130, 246, 0.15);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: var(--text); }
h1,h2,h3,h4,strong { color: var(--text); margin: 0; }

/* ─── Shell ─── */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 1.5rem 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.25rem 0.5rem 1.5rem;
  margin-bottom: 0.5rem;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-darker) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: -0.03em;
  flex-shrink: 0;
}

.brand h1 {
  font-size: 1.0625rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.brand span {
  display: block;
  font-size: 0.6875rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-top: 1px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 1.5rem; }

.nav-section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0 0.75rem;
  margin-bottom: 0.375rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity var(--transition);
}

.nav-link:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.nav-link:hover .nav-icon { opacity: 1; stroke: var(--primary); }

.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
  box-shadow: none;
  border: 1px solid var(--primary-light);
}

.nav-link.active .nav-icon { opacity: 1; stroke: var(--primary); }

/* ─── Main ─── */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-left { display: flex; flex-direction: column; gap: 1px; }
.topbar-greeting { font-size: 0.75rem; color: var(--muted); font-weight: 500; }
.topbar-left strong { font-size: 0.9375rem; font-weight: 700; letter-spacing: -0.02em; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.role-pill {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: capitalize;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid var(--primary-light);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-darker) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.8125rem;
  font-weight: 700;
}

.content {
  padding: 2rem;
  flex: 1;
}

/* ─── Page header ─── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.page-subtitle {
  margin: 0.375rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 400;
}

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 1.5rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.card-header h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  margin-top: 0;
  letter-spacing: -0.02em;
}

.card + .card { margin-top: 1rem; }

/* ─── Grid ─── */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

/* ─── Stat cards ─── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.375rem;
  box-shadow: var(--shadow-xs);
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  transition: box-shadow var(--transition), transform var(--transition);
}

.stat:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  border: 1px solid var(--primary-light);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--primary);
}

.stat-body { min-width: 0; }

.stat .label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}

.stat .value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

/* ─── Summary panel ─── */
.summary-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-xs);
}

.summary-panel h3 {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.875rem;
}

.summary-row:last-child { border-bottom: none; }
.summary-row span:first-child { color: var(--muted); font-weight: 500; }
.summary-row strong { font-weight: 700; letter-spacing: -0.02em; }
.summary-row.highlight {
  margin-top: 0.5rem;
  padding-top: 0.875rem;
  border-top: 2px solid var(--primary);
  border-bottom: none;
}
.summary-row.highlight strong { font-size: 1.125rem; color: var(--primary-dark); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border-radius: var(--radius-xs);
  padding: 0.625rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: -0.01em;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.btn:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-darker) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.btn:active { transform: translateY(0); }

.btn.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.btn.secondary:hover {
  background: var(--primary-soft);
  border-color: var(--primary-light);
  color: var(--primary-dark);
}

.btn.ghost {
  background: transparent;
  color: var(--text-secondary);
  box-shadow: none;
  border: 1px solid transparent;
}

.btn.ghost:hover {
  background: var(--surface-muted);
  color: var(--text);
  box-shadow: none;
  transform: none;
}

.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #dc2626; }

.btn.sm { padding: 0.4375rem 0.875rem; font-size: 0.8125rem; }
.btn.block { width: 100%; }

/* ─── Tables ─── */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  text-align: left;
  padding: 0.875rem 1.125rem;
  border-bottom: 1px solid var(--border-subtle);
}

th {
  background: var(--surface-muted);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

tbody tr { transition: background var(--transition); }
tbody tr:hover td { background: var(--primary-soft); }
tbody tr:last-child td { border-bottom: none; }

/* ─── Forms ─── */
.form-row { display: grid; gap: 1rem; margin-bottom: 1.25rem; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-row.cols-4 { grid-template-columns: repeat(4, 1fr); }

.field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4375rem;
  letter-spacing: -0.01em;
}

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4375rem;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.6875rem 0.9375rem;
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:hover, select:hover, textarea:hover { border-color: #d4d4d4; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

input::placeholder { color: #a3a3a3; }

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.badge.low {
  background: var(--warning-soft);
  color: #b45309;
  border-color: #fde68a;
}

.badge.status {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: var(--primary-light);
}

.badge.muted {
  background: var(--surface-muted);
  color: var(--muted);
}

/* ─── Toolbar & tabs ─── */
.toolbar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.25rem;
}

.toolbar .spacer { flex: 1; }

.tabs {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-xs);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  border: none;
  background: transparent;
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
}

.tab:hover { color: var(--primary-dark); }

.tab.active {
  background: var(--surface);
  color: var(--primary-dark);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--primary-light);
}

/* ─── Alerts ─── */
.flash, .error {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.flash.success {
  background: var(--success-soft);
  color: #047857;
  border: 1px solid #a7f3d0;
  box-shadow: var(--shadow-xs);
}

.flash.error, .error {
  background: var(--danger-soft);
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* ─── Login ─── */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface);
}

.login-brand {
  background: linear-gradient(145deg, #1d4ed8 0%, #3b82f6 50%, #60a5fa 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem;
  position: relative;
  overflow: hidden;
}

.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,.04) 0%, transparent 40%);
}

.login-brand-inner { position: relative; z-index: 1; max-width: 400px; }

.login-brand .brand-mark {
  width: 56px;
  height: 56px;
  font-size: 1.5rem;
  background: #fff;
  color: var(--primary-dark);
  margin-bottom: 2rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
}

.login-brand h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  color: #fff;
  margin-bottom: 1rem;
}

.login-brand p {
  font-size: 1rem;
  color: rgba(255,255,255,.65);
  line-height: 1.7;
  margin: 0;
}

.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg);
}

.login-card {
  width: min(400px, 100%);
}

.login-card h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.375rem;
}

.login-card .login-sub {
  color: var(--muted);
  font-size: 0.9375rem;
  margin-bottom: 2rem;
}

.login-hint {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.6;
  border: 1px solid var(--border);
}

.auth-switch {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
}

.auth-switch a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* ─── POS picker ─── */
.pos-picker {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 1.25rem;
}

.search-input {
  position: relative;
}

.search-input input {
  padding-left: 2.5rem;
}

.search-input::before {
  content: "";
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23737373' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") center/contain no-repeat;
  pointer-events: none;
  z-index: 1;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 0.75rem;
  max-height: 460px;
  overflow-y: auto;
  padding: 2px;
  margin-top: 1rem;
}

.product-tile {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
}

.product-tile:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.12);
  transform: translateY(-2px);
}

.product-tile .sku {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.product-tile .name {
  font-weight: 700;
  font-size: 0.875rem;
  margin: 0.375rem 0 0.25rem;
  letter-spacing: -0.02em;
}

.product-tile .meta {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 500;
}

.cart-panel {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.cart-panel h3 {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.cart-list { display: flex; flex-direction: column; gap: 0.5rem; }

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.625rem;
  align-items: center;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}

.cart-item strong { font-size: 0.8125rem; font-weight: 600; }
.cart-item .sku-text { font-size: 0.6875rem; color: var(--muted); }

.qty-input { width: 72px; text-align: center; }

.empty {
  color: var(--muted);
  padding: 2.5rem 1rem;
  text-align: center;
  font-size: 0.875rem;
}

/* ─── Sales rep dashboard & sale form ─── */
.rep-trip-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
}
.rep-trip-banner .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.rep-trip-banner strong {
  display: block;
  font-size: 1.125rem;
  margin-bottom: 0.25rem;
}
.rep-trip-banner .muted {
  font-size: 0.875rem;
  color: var(--muted);
}
.rep-trip-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0 1.5rem;
}
.payment-type-tabs {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.payment-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  background: #fff;
}
.payment-option:has(input:checked) {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
}
.sale-total {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 1rem;
}
.sale-total strong {
  color: var(--primary);
  font-size: 1.25rem;
}
.sale-summary-row {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}
.sale-summary-row:last-child {
  border-bottom: none;
}
.sale-summary-amount {
  font-weight: 700;
  margin: 0.25rem 0;
}
.sale-summary-payments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin: 0.375rem 0;
}
.sale-summary-items {
  font-size: 0.8125rem;
}
.sale-line-item {
  font-size: 0.8125rem;
  line-height: 1.4;
}
.qty-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.qty-input {
  width: 64px;
  text-align: center;
  padding: 0.4rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-weight: 700;
}
.qty-btn {
  min-width: 36px;
  padding: 0.35rem 0.5rem !important;
}
.sale-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.sale-section:last-of-type { border-bottom: none; }
.sale-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sales-page-layout {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 1.25rem;
  align-items: start;
}
.sale-main-card { padding: 1.25rem; }
.btn-save-sale {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
}
.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 768px) {
  .sales-page-layout { grid-template-columns: 1fr; }
}
.sales-layout {
  align-items: start;
}
.sales-layout .card {
  position: sticky;
  top: 1rem;
}

/* ─── Responsive / mobile ─── */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  cursor: pointer;
  flex-shrink: 0;
}
.menu-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}
.sidebar-close {
  display: none;
  margin-left: auto;
  border: none;
  background: transparent;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 90;
  pointer-events: none;
}
.grid.grid-3.stock-panels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.mobile-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.mobile-scroll table {
  min-width: 280px;
}

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid.grid-3.stock-panels { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .sidebar-close { display: block; }
  .app-shell { flex-direction: row; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    height: 100%;
    z-index: 100;
    transform: translateX(-105%);
    transition: transform 0.25s ease, visibility 0.25s ease;
    box-shadow: none;
    pointer-events: none;
    visibility: hidden;
  }
  .app-shell.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.18);
    pointer-events: auto;
    visibility: visible;
  }
  .app-shell.nav-open .sidebar-backdrop {
    display: block;
    pointer-events: auto;
  }
  .sidebar-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 1rem;
    overflow-y: auto;
    max-height: calc(100vh - 100px);
    padding-bottom: 2rem;
  }
  .nav-section { display: block; }
  .nav-section-label { display: block; }
  .brand { align-items: center; }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 0.75rem max(1rem, env(safe-area-inset-right)) 0.75rem max(1rem, env(safe-area-inset-left));
    gap: 0.75rem;
  }
  .topbar-left {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
  }
  .topbar-right .role-pill { display: none; }
  .content { padding: 1rem max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }
  input, select, textarea {
    font-size: 16px;
    min-height: 44px;
  }
  .btn, .menu-toggle, .nav-link, .tab, .product-tile, .payment-option, .qty-btn {
    min-height: 44px;
  }
  .btn.sm {
    min-height: 40px;
    padding: 0.5rem 0.875rem;
  }
  .nav-link {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
  .product-tile {
    min-height: 88px;
  }
  .qty-input {
    min-height: 44px;
    width: 56px;
    font-size: 16px;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .page-header .actions,
  .page-header-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .login-page { grid-template-columns: 1fr; }
  .login-brand { padding: 2rem 1.25rem; min-height: auto; }
  .login-brand h1 { font-size: 1.5rem; }
  .login-form-side { padding: 1.25rem; }
  .login-card { width: 100%; max-width: 100%; }
  .grid-2, .grid-3, .grid-4, .grid.grid-3.stock-panels, .pos-picker,
  .form-row.cols-2, .form-row.cols-3, .form-row.cols-4,
  .sales-layout {
    grid-template-columns: 1fr !important;
  }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .stat { padding: 0.875rem; }
  .stat .value { font-size: 1.15rem; }
  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
  }
  .tab { white-space: nowrap; flex-shrink: 0; }
  .table-wrap, .mobile-scroll {
    margin: 0 -0.25rem;
  }
  .btn.block, button.btn[type="submit"] {
    min-height: 44px;
  }
  .product-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .rep-trip-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  .rep-trip-actions {
    width: 100%;
  }
  .rep-trip-actions .btn {
    flex: 1;
    text-align: center;
  }
  .payment-type-tabs {
    flex-direction: column;
  }
  .payment-option { width: 100%; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0.75rem; }
  .user-avatar { display: none; }
  .product-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}
