/* ── RESET & ROOT ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface2: #f0ede8;
  --surface3: #e8e4de;
  --border: #ddd8d0;
  --orange: #e01c1c; /* Changed to red for unified branding */
  --font-body: 'DM Sans', sans-serif;
  --font-header: 'Bebas Neue', sans-serif;
  --font-ui: 'Rajdhani', sans-serif;
  --orange-glow: rgba(224,28,28,0.14);
  --orange-dim: rgba(224,28,28,0.08);
  --text: #1a1612;
  --muted: #9e9488;
  --muted2: #6b6259;
  --green: #16a34a;
  --red: #dc2626;
  --radius: 10px;
  --sidebar-w: 230px;
  --topbar-h: 56px;
}

html { height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

/* ── CURRENCY SYMBOL ── */
.currency-symbol {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 500;
  margin-right: 2px;
}

/* ── LOADING ── */
#loadingScreen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9999; gap: 18px;
}
.spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── LOGIN ── */
#loginDiv {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: var(--bg);
  background-image: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(224, 28, 28,0.10) 0%, transparent 70%);
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 32px;
  width: 100%; max-width: 400px;
  position: relative; overflow: hidden;
  animation: fadeUp 0.45s ease both;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.login-box::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--orange), transparent);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo svg { width: 64px; height: 64px; margin: 0 auto 12px; display: block; }
.login-logo .brand {
  font-family: var(--font-header);
  font-size: 38px; font-weight: 400; letter-spacing: 3px; color: var(--orange); line-height: 1;
}
.login-logo .tagline { font-size: 11px; color: var(--muted2); letter-spacing: 2px; text-transform: uppercase; margin-top: 6px; }

/* ── APP SHELL ── */
#app {
  display: flex;
  min-height: 100vh;
  animation: fadeIn 0.3s ease backwards;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 50;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 1px 0 8px rgba(0,0,0,0.05);
}
.sidebar-header {
  padding: 20px 16px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.sidebar-header svg { width: 32px; height: 32px; flex-shrink: 0; }
.sidebar-brand {
  font-family: var(--font-header);
  font-size: 22px; font-weight: 400; letter-spacing: 1.5px; color: var(--orange); line-height: 1;
}
.sidebar-sub { font-size: 9px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav-section-label {
  font-size: 9px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--muted);
  padding: 14px 8px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 11px 12px;
  background: none; border: none; border-radius: 8px;
  color: var(--muted2);
  font-family: var(--font-body);
  font-size: 13px; font-weight: 600; letter-spacing: 0.3px;
  cursor: pointer; text-align: left;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--orange-dim); color: var(--orange); border-left: 3px solid var(--orange); padding-left: 9px; }
.nav-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.sidebar-footer {
  padding: 10px 10px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  min-width: 0;
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--orange); border: none;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ui);
  font-size: 13px; font-weight: 700; letter-spacing: 0.5px;
  color: #fff; flex-shrink: 0;
}
.user-info { min-width: 0; flex: 1; overflow: hidden; }
.user-greeting {
  font-family: var(--font-ui);
  font-size: 14px; font-weight: 700; letter-spacing: 0.3px;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.user-meta-row {
  display: flex; align-items: center;
  margin-top: 5px; min-width: 0;
}
.role-badge {
  display: inline-block;
  font-size: 9px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  padding: 2px 7px; border-radius: 4px; flex-shrink: 0;
}
.role-badge.admin { background: rgba(224, 28, 28,0.12); color: var(--orange); border: 1px solid rgba(224, 28, 28,0.25); }
.role-badge.staff { background: rgba(22,163,74,0.10); color: var(--green); border: 1px solid rgba(22,163,74,0.2); }
.logout-nav-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 12px;
  background: none; border: 1px solid transparent; border-radius: 8px;
  color: var(--muted2);
  font-family: var(--font-body);
  font-size: 12px; font-weight: 600; letter-spacing: 0.2px;
  cursor: pointer; transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.logout-nav-btn:hover { background: rgba(220,38,38,0.07); border-color: rgba(220,38,38,0.2); color: var(--red); }

/* ── MOBILE TOP BAR ── */
.mobile-topbar {
  display: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
  height: var(--topbar-h);
  align-items: center;
  justify-content: space-between;
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 40;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
.hamburger {
  background: none; border: none; color: var(--text);
  font-size: 22px; cursor: pointer; padding: 6px;
  border-radius: 6px;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}
.hamburger:hover { background: var(--surface2); }
.mobile-brand {
  font-family: var(--font-header);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 1.5px;
  color: var(--orange);
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 49;
  backdrop-filter: blur(2px);
}

/* ── MAIN CONTENT ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  background: var(--bg);
  background-image: radial-gradient(ellipse 80% 30% at 60% 0%, rgba(224, 28, 28,0.06) 0%, transparent 60%);
  min-width: 0;
}
.page-header {
  padding: 28px 28px 0;
  margin-bottom: 20px;
}
.page-title {
  font-family: var(--font-ui);
  font-size: 22px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--text);
}
.page-subtitle { font-size: 13px; color: var(--muted2); margin-top: 3px; }
.content { padding: 0 28px 48px; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 22px;
  margin-bottom: 18px;
  position: relative; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.card-title {
  font-family: var(--font-ui);
  font-size: 13px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--orange); margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.card-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── FIELDS ── */
.field-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.8px; text-transform: uppercase;
  color: var(--muted2); margin-bottom: 6px; display: block;
}
.field-group { margin-bottom: 14px; }
.req { color: var(--red); margin-left: 2px; }

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="month"],
select {
  width: 100%; padding: 11px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font-body);
  /* font-size >= 16px prevents iOS auto-zoom on input focus */
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none; appearance: none; -webkit-appearance: none;
}
input:focus, select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a09890' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
select option { background: var(--surface2); }
#vehicleNo { text-transform: uppercase; }
#vehicleNo::placeholder { text-transform: none; }

/* ── FILTER INPUTS ── */
.filter-input {
  height: 38px;
  padding: 0 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
  display: inline-block;
}
.filter-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}
select.filter-input {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a09890' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  appearance: none;
  -webkit-appearance: none;
}

/* Premium webkit picker indicator styling */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: opacity(0.55);
  transition: filter 0.15s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover {
  filter: opacity(0.85);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }


/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 20px; border: none; border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13px; font-weight: 700; letter-spacing: 0.4px;
  cursor: pointer; transition: transform 0.12s, box-shadow 0.12s, background 0.12s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: var(--orange); color: #fff;
  width: 100%;
  padding: 14px; font-size: 15px;
  box-shadow: 0 4px 20px rgba(224, 28, 28,0.25);
}
.btn-primary:hover { background: #c2440a; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--orange); color: var(--orange); }
.btn-success { background: var(--green); color: #fff; box-shadow: 0 4px 14px rgba(22,163,74,0.15); }
.btn-success:hover { background: #15803d; }
.btn-danger { background: rgba(220,38,38,0.10); color: var(--red); border: 1px solid rgba(220,38,38,0.2); padding: 6px 11px; font-size: 12px; }
.btn-sm { padding: 8px 14px; font-size: 12px; }



/* ── PARTS LIST ── */
.parts-list { margin: 14px 0; display: flex; flex-direction: column; gap: 8px; }
.part-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px;
  animation: slideIn 0.18s ease both;
  gap: 10px;
}
.part-item-left { min-width: 0; flex: 1; }
.part-item-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.part-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.part-meta { font-size: 11px; color: var(--muted2); margin-top: 2px; }
.part-subtotal { font-weight: 600; font-size: 13px; white-space: nowrap; }

.total-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 16px; margin-top: 4px;
}
.total-label { font-family: var(--font-ui); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted2); }
.total-amount { font-family: var(--font-ui); font-size: 18px; font-weight: 700; color: var(--orange); }

.service-charge-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 16px; margin-top: 8px; gap: 12px;
}
.service-charge-left { display: flex; flex-direction: column; min-width: 0; }
.service-charge-label { font-family: var(--font-ui); font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted2); }
.service-charge-hint { font-size: 10px; color: var(--muted); margin-top: 2px; }
.service-charge-input-wrap { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.service-charge-prefix { font-family: var(--font-ui); font-size: 18px; font-weight: 700; color: var(--muted2); }
.service-charge-input-wrap input { min-width: 80px; max-width: 120px; width: 110px; text-align: right; font-weight: 600; padding: 6px 10px; }

.grand-total-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(224, 28, 28,0.10); border: 1px solid rgba(224, 28, 28,0.25);
  border-radius: 8px; padding: 13px 16px; margin-top: 8px;
}
.grand-total-amount {
  font-family: var(--font-header);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: 1px;
  color: var(--orange);
}

.confirm-row { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0 8px; cursor: pointer; }
.confirm-row input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--green); margin-top: 1px; }
.confirm-row span { font-size: 13px; color: var(--muted2); line-height: 1.4; }

/* ── MODEL CHIPS ── */
.model-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.model-chip {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 12px;
  font-size: 12px; font-weight: 500;
  animation: slideIn 0.15s ease both;
}
.model-chip button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 2px;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.model-chip button:hover { color: var(--red); }

/* ── TABLE ── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--surface2); color: var(--muted2);
  font-family: var(--font-ui);
  font-size: 10px; font-weight: 700; letter-spacing: 1.8px; text-transform: uppercase;
  padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }

/* ── STAT CARDS ── */
.stat-row { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-card {
  flex: 1; min-width: 110px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px;
}
.stat-value {
  font-family: var(--font-header);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: 1px;
  color: var(--orange);
}
.stat-label { font-size: 11px; color: var(--muted2); letter-spacing: 0.8px; text-transform: uppercase; margin-top: 3px; }

/* ── STOCK TABLE ── */

.stock-brand-header {
  font-family: var(--font-ui);
  font-size: 13px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--orange); padding: 10px 14px;
  background: var(--orange-dim); border: 1px solid rgba(224, 28, 28,0.15);
  border-radius: 8px 8px 0 0; border-bottom: none;
}
.stock-wrap { border: 1px solid var(--border); border-radius: 0 0 8px 8px; overflow-x: auto; margin-top: 0; -webkit-overflow-scrolling: touch; }
.stock-table { width: 100%; border-collapse: collapse; min-width: 480px; }
.stock-table th {
  background: var(--surface2); color: var(--muted2);
  font-family: var(--font-ui);
  font-size: 10px; font-weight: 700; letter-spacing: 1.8px; text-transform: uppercase;
  padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--border);
}
.stock-table td { padding: 9px 14px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 13px; }
.stock-table tr:last-child td { border-bottom: none; }
.stock-table tr:hover td { background: rgba(0,0,0,0.02); }
.stock-qty-ok { color: var(--green); font-weight: 600; font-size: 13px; }
.stock-qty-low { color: #d97706; font-weight: 600; font-size: 13px; }
.stock-qty-out { color: var(--red); font-weight: 600; font-size: 13px; }
.stock-filter-row { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.stock-filter-row select { width: auto; min-width: 160px; flex: 1; }
.stock-badge {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; padding: 2px 8px; border-radius: 20px;
}
.badge-ok { background: rgba(34,197,94,0.1); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.badge-low { background: rgba(245,158,11,0.1); color: #f59e0b; border: 1px solid rgba(245,158,11,0.2); }
.badge-out { background: rgba(239,68,68,0.1); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }

/* ── INACTIVITY TIMER BAR ── */
#sessionBar {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  background: var(--border); z-index: 999; display: none;
}
#sessionBarFill {
  height: 100%; background: var(--orange);
  transition: width 1s linear;
}
#sessionWarning {
  position: fixed; bottom: 64px; right: 16px;
  background: var(--surface); border: 1px solid rgba(224, 28, 28,0.35);
  border-radius: 10px; padding: 10px 16px;
  font-size: 12px; color: var(--orange);
  display: none; z-index: 998;
  font-family: var(--font-body);
  letter-spacing: 0.3px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

/* ── SUBMIT BUTTON (service page specific) ── */
.submit-service-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 24px;
  background: var(--green); color: #fff;
  border: none; border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13px; font-weight: 700; letter-spacing: 0.4px;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(22,163,74,0.2);
  transition: transform 0.12s, background 0.12s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  margin-top: 12px;
  align-self: flex-end;
}
.submit-service-btn:active { transform: scale(0.96); }
.submit-service-btn:hover { background: #15803d; }
.submit-service-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── MODALS ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
  -webkit-overflow-scrolling: touch;
  overflow-y: auto;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%; max-width: 520px;
  position: relative;
  transform: translateY(24px) scale(0.97);
  transition: transform 0.25s cubic-bezier(.34,1.4,.64,1);
  overflow: hidden;
  max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}
.modal-overlay.open .modal-box { transform: translateY(0) scale(1); }

.modal-top-bar {
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--orange), transparent);
  flex-shrink: 0;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 0;
  flex-shrink: 0;
}
.modal-title {
  font-family: var(--font-ui);
  font-size: 19px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase;
  color: var(--orange);
}
.modal-close {
  background: none; border: none; color: var(--muted2); font-size: 20px;
  cursor: pointer; line-height: 1; padding: 6px; border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }
.modal-body { padding: 16px 22px 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 0 22px 20px;
  flex-shrink: 0;
}

/* Review modal */
.review-section { margin-bottom: 16px; }
.review-label { font-size: 10px; font-weight: 700; letter-spacing: 1.8px; text-transform: uppercase; color: var(--muted2); margin-bottom: 8px; }
.review-info-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.review-field {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; flex: 1; min-width: 100px;
}
.review-field-label { font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.review-field-val { font-size: 14px; font-weight: 600; }
.review-parts-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.review-parts-table th {
  text-align: left; padding: 6px 10px;
  font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted2);
  border-bottom: 1px solid var(--border);
}
.review-parts-table td { padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.review-total-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}
.review-total-label { font-family: var(--font-ui); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted2); }
.review-total-val { font-family: var(--font-ui); font-size: 18px; font-weight: 700; color: var(--orange); }

/* Logout modal */
.logout-modal-icon { text-align: center; font-size: 40px; margin-bottom: 12px; }
.logout-modal-msg { text-align: center; font-size: 14px; color: var(--muted2); line-height: 1.6; }

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 20px; right: 16px; left: 16px;
  max-width: 340px; margin: 0 auto;
  background: var(--text); border: 1px solid rgba(0,0,0,0.1);
  border-radius: 10px; padding: 13px 16px; font-size: 13px;
  color: #fff;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  transform: translateY(80px); opacity: 0;
  transition: all 0.3s cubic-bezier(.34,1.56,.64,1);
  z-index: 999;
}
@media (min-width: 480px) {
  #toast { left: auto; bottom: 24px; right: 24px; }
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast[data-type="success"] { border-color: var(--green); }
#toast[data-type="error"] { border-color: var(--red); }
.toast-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
#toast[data-type="success"] .toast-dot { background: var(--green); }
#toast[data-type="error"] .toast-dot { background: var(--red); }

/* ── USER ITEM CARDS ── */
.user-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px;
  animation: slideIn 0.18s ease both;
}
.user-item-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--orange-dim); border: 1px solid rgba(224, 28, 28,0.25);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ui); font-size: 16px; letter-spacing: 1px;
  color: var(--orange);
}
.user-item-info { flex: 1; min-width: 0; }
.user-item-name { font-weight: 700; font-size: 14px; color: var(--text); }
.user-item-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 3px; font-size: 11px; color: var(--muted2); }
.user-item-badges { display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0; align-items: center; }

.user-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  padding: 2px 9px; border-radius: 20px;
}
.user-badge.verified   { background: rgba(22,163,74,0.1);  color: var(--green); border: 1px solid rgba(22,163,74,0.25); }
.user-badge.unverified { background: rgba(224, 28, 28,0.08); color: var(--orange); border: 1px solid rgba(224, 28, 28,0.2); }

/* ── INFO NOTICE ── */
.info-notice {
  background: rgba(224, 28, 28,0.06); border: 1px solid rgba(224, 28, 28,0.18);
  border-radius: 8px; padding: 10px 14px; font-size: 12px; color: var(--muted2); line-height: 1.5;
}

/* ── REPORTS ── */

/* Report table wrapper — always scrollable on any screen */
.report-table-wrap {
  overflow-x: auto;
  margin-top: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
  /* Ensure it never bleeds outside card */
  max-width: 100%;
}
.report-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  /* Enough for all columns without wrapping */
  min-width: 960px; /* stacked Free Service column is narrower */
  white-space: nowrap;
}
/* Vehicle No cell must wrap so badge/km/thumb stack vertically */
.report-table-wrap td.report-vehicle-cell {
  white-space: normal;
  min-width: 120px;
  vertical-align: top;
  padding-top: 8px;
  padding-bottom: 8px;
}

/* Tighter cell padding inside report tables for denser layout */
.report-table-wrap thead th { padding: 8px 10px; }
.report-table-wrap tbody td { padding: 6px 10px; }
.report-table-wrap .report-footer-row td { padding: 7px 10px; }

/* Charge breakdown rows */
.report-charge-cell { text-align: right; color: var(--muted2); font-size: 12px; }
.report-parts-total { font-weight: 500; color: var(--text); }
.report-grand-total { font-weight: 700; color: var(--text); }
.report-svc-charge  { color: var(--muted2); }

/* Parts list in cell */
.report-parts-list { font-size: 11px; color: var(--muted2); white-space: normal; max-width: 200px; line-height: 1.5; }

/* Charge summary footer */
.report-footer-row td {
  background: var(--surface2);
  font-weight: 600; font-size: 12px;
  padding: 9px 14px;
  border-top: 2px solid var(--border);
}
.report-grand-row td {
  background: rgba(224, 28, 28,0.07);
  color: var(--orange);
  font-weight: 700; font-size: 13px;
  border-top: 1px solid rgba(224, 28, 28,0.18);
}

/* ── PRINT BILL ── */
/* jsPDF handles PDF generation; this frame is unused but kept as fallback */
#printBillFrame { display: none; }

/* ── INVENTORY TABS ── */
.inv-tab-active {
  background: var(--orange-dim) !important;
  border-color: rgba(224, 28, 28,0.35) !important;
  color: var(--orange) !important;
}

/* Compat model checkbox grid */
.compat-model-checkbox {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 10px; font-size: 12px;
  cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.compat-model-checkbox:hover { background: var(--surface3); }
.compat-model-checkbox input[type="checkbox"] { accent-color: var(--orange); width: 14px; height: 14px; cursor: pointer; }

/* ── UTILS ── */
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }

/* ── ANIMATIONS ── */
@keyframes fadeUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:none; } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes slideIn { from { opacity:0; transform:translateX(-8px); } to { opacity:1; transform:none; } }

/* ════════════════════════════
   RESPONSIVE BREAKPOINTS
════════════════════════════ */

/* ── TABLET (769–1024px) ── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 200px; }
}

/* ── MOBILE (≤768px) ── */
@media (max-width: 768px) {
  /* Show topbar, hide sidebar by default */
  .mobile-topbar { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    top: 0; /* overlaps topbar intentionally so it feels native */
    z-index: 60;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  /* Main content starts below fixed topbar */
  .main {
    margin-left: 0;
    padding-top: var(--topbar-h);
  }

  .page-header { padding: 18px 14px 0; }
  .content { padding: 0 14px 60px; }

  .card { padding: 16px; border-radius: 12px; }

  /* Stack all form rows on mobile */
  .form-row { grid-template-columns: 1fr; gap: 4px; }

  /* Bigger tap targets */
  input[type="email"],
  input[type="password"],
  input[type="text"],
  input[type="number"],
  input[type="tel"],
  input[type="date"],
  input[type="month"],
  select {
    padding: 13px 14px;
  }

  .btn { padding: 13px 18px; font-size: 14px; }
  .btn-sm { padding: 10px 14px; font-size: 13px; }

  /* Part item on mobile */
  .part-name { font-size: 12px; }
  .part-subtotal { font-size: 12px; }

  /* Table scrolls horizontally */
  .report-table-wrap { border-radius: 8px; }
  .report-table-wrap table { min-width: 900px; } /* U-1 fix: 10-col table needs more space */

  /* Modal full-width on mobile */
  .modal-overlay { padding: 12px 10px; align-items: flex-end; }
  .modal-box { border-radius: 16px 16px 10px 10px; max-height: 92vh; }

  /* Chips wrap nicely */
  .model-chip { font-size: 11px; padding: 5px 10px; }

  /* Stats */
  .stat-row { gap: 8px; margin-bottom: 16px; }
  .stat-card { flex: 1 1 calc(50% - 4px); min-width: 130px; padding: 10px 12px; border-radius: 10px; }
  .stat-value {
    font-family: var(--font-header);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.5px;
    word-break: break-all;
  }
  .stat-label { font-size: 9px; letter-spacing: 0.5px; margin-top: 2px; }

  /* Stock table mobile — still horizontally scrollable */
  .stock-table th,
  .stock-table td { padding: 8px 10px; font-size: 12px; }
  .stock-brand-header { font-size: 12px; padding: 9px 12px; letter-spacing: 1.5px; }
  .stock-badge { font-size: 9px; padding: 2px 6px; }
  
}

/* ── WHATSAPP BUTTON ── */
.btn-whatsapp {
  display: inline-flex; align-items: center; gap: 5px;
  background: #25D366; color: #fff;
  border: none; border-radius: 8px;
  padding: 6px 12px; font-size: 12px; font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer; transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn-whatsapp:hover  { background: #1ebe5d; }
.btn-whatsapp:active { background: #17a84f; }
.btn-whatsapp:disabled,
.btn-whatsapp[disabled] { opacity: 0.55; cursor: not-allowed; }
@media (max-width: 375px) {
  .mobile-brand {
  font-family: var(--font-header);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 1.5px;
  color: var(--orange);
}
  .page-title { font-size: 22px; }
  .content { padding: 0 12px 60px; }
  .card { padding: 14px; }
  .total-amount { font-size: 20px; }
}

/* ── STOCK TABLE: always scroll horizontally, never hide columns ── */
@media (max-width: 480px) {
  .stock-table { min-width: 520px; }
}

/* Category divider rows inside unified stock table */
.stock-category-row td {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  border-top: 2px solid var(--border);
  padding: 8px 14px !important;
  font-family: var(--font-ui);
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--orange);
}
.stock-category-row:first-child td { border-top: none; }

/* ── STOCK TABLE: hide Last Restocked column on narrow screens ── */
.col-restocked { white-space: nowrap; }
/* Part No column — always visible; reduce font on small screens for readability */
.col-partno { white-space: nowrap; font-size: 12px; }
@media (max-width: 600px) {
  .col-restocked { display: none; }
  .col-partno    { font-size: 11px; max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
}
/* ── FREE SERVICE TOGGLE ── */
/* Segmented toggle: integrates naturally with existing RPM design language */
.free-svc-toggle {
  display: inline-flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
}
.free-svc-toggle button {
  flex: 1;
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 13px; font-weight: 700; letter-spacing: 0.3px;
  cursor: pointer;
  background: transparent;
  color: var(--muted2);
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.free-svc-toggle button.active {
  background: var(--surface);
  color: var(--orange);
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
  border: 1px solid var(--border);
}
.free-svc-toggle button.active-yes {
  background: rgba(22,163,74,0.12);
  color: var(--green);
  box-shadow: 0 1px 4px rgba(22,163,74,0.15);
  border: 1px solid rgba(22,163,74,0.30);
}

/* ── FREE SERVICE CONDITIONAL FIELDS ── */
/* Wrapper uses max-height animation so layout collapses fully when hidden */
#freeSvcFields {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.32s cubic-bezier(0.4,0,0.2,1), opacity 0.22s ease;
  /* No margin — spacing comes from inner field-groups only */
}
#freeSvcFields.fs-visible {
  max-height: 600px; /* generous upper bound */
  opacity: 1;
}

/* ── ODOMETER UPLOAD AREA ── */
.odometer-upload-area {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
  background: var(--surface2);
  position: relative;
}
.odometer-upload-area:hover { border-color: var(--orange); background: var(--orange-dim); }
.odometer-upload-area input[type="file"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; font-size: 0;
}
.odometer-upload-icon { font-size: 26px; margin-bottom: 6px; }
.odometer-upload-label { font-size: 12px; color: var(--muted2); font-weight: 600; }
.odometer-upload-hint  { font-size: 10px; color: var(--muted);  margin-top: 3px; }



/* Upload progress indicator */
.odometer-upload-status {
  font-size: 11px; margin-top: 6px; min-height: 14px;
  font-weight: 600;
}

/* ── FREE SERVICE badge — shown in report rows ── */
.badge-free-svc {
  display: inline-block;
  font-size: 9px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 7px; border-radius: 4px;
  background: rgba(22,163,74,0.12);
  color: var(--green);
  border: 1px solid rgba(22,163,74,0.28);
  white-space: nowrap;
  vertical-align: middle;
}

/* ── PAID SERVICE badge — shown when not a free service ── */
.badge-paid-svc {
  display: inline-block;
  font-size: 9px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 7px; border-radius: 4px;
  background: rgba(107,98,89,0.08);
  color: var(--muted2);
  border: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
}

/* ── FREE SERVICE column cell layout — stacked ── */
.free-svc-cell {
  vertical-align: middle;
  padding: 6px 10px !important;
}
.free-svc-row {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}
.odometer-thumb-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted2);
  font-family: var(--font-body);
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}
.odometer-thumb-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
  background: var(--orange-dim);
}

/* ── ODOMETER LIGHTBOX ── */
#odometerLightbox {
  display: none;
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
  animation: fadeIn 0.18s ease both;
}
#odometerLightbox.open { display: flex; }
.odometer-lightbox-inner {
  position: relative;
  max-width: min(92vw, 700px);
  max-height: 90vh;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.55);
  animation: fadeUp 0.22s ease both;
}
.odometer-lightbox-inner img {
  display: block;
  width: 100%; height: auto;
  max-height: 90vh;
  object-fit: contain;
  background: #111;
}
.odometer-lightbox-header {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 10px 14px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
  display: flex; align-items: center; justify-content: space-between;
}
.odometer-lightbox-title {
  font-family: var(--font-ui);
  font-size: 12px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: rgba(255,255,255,0.85);
}
.odometer-lightbox-close {
  background: rgba(255,255,255,0.15); border: none;
  color: #fff; border-radius: 50%;
  width: 30px; height: 30px;
  font-size: 16px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}
.odometer-lightbox-close:hover { background: rgba(255,255,255,0.28); }
.odometer-lightbox-footer {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 10px 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.65), transparent);
  display: flex; align-items: center; justify-content: space-between;
}
.odometer-lightbox-meta {
  font-size: 11px; color: rgba(255,255,255,0.75);
  font-family: var(--font-body);
}
.odometer-lightbox-open-link {
  font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.85);
  text-decoration: none; letter-spacing: 0.5px;
  font-family: var(--font-body);
  background: rgba(255,255,255,0.15); border-radius: 5px;
  padding: 4px 9px;
}
.odometer-lightbox-open-link:hover { background: rgba(255,255,255,0.28); }


/* ── SEARCHABLE COMBOBOX ── */
.inv-combobox {
  position: relative;
  width: 100%;
}
.inv-combobox-trigger {
  width: 100%; padding: 11px 36px 11px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font-body); font-size: 16px;
  cursor: pointer; text-align: left; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; min-height: 46px;
  white-space: nowrap; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.inv-combobox-trigger:focus,
.inv-combobox-trigger.open {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}
.inv-combobox-trigger-text {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 15px;
}
.inv-combobox-trigger-text.placeholder { color: var(--muted); font-size: 14px; }
.inv-combobox-arrow {
  flex-shrink: 0; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); transition: transform 0.2s;
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  pointer-events: none;
}
.inv-combobox-trigger.open .inv-combobox-arrow { transform: translateY(-50%) rotate(180deg); }

.inv-combobox-dropdown {
  position: fixed;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; z-index: 9999;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  overflow: hidden;
  animation: comboSlideIn 0.16s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes comboSlideIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.inv-combobox-search-wrap {
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 1;
}
.inv-combobox-search {
  width: 100%; padding: 9px 12px 9px 34px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-family: var(--font-body); font-size: 14px;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a09890' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}
.inv-combobox-search:focus { border-color: var(--orange); box-shadow: 0 0 0 2px var(--orange-glow); }
.inv-combobox-list {
  max-height: 280px; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px;
}
.inv-combobox-option {
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  transition: background 0.1s;
  display: flex; flex-direction: column; gap: 3px;
  margin-bottom: 2px;
  -webkit-tap-highlight-color: transparent;
}
.inv-combobox-option:hover,
.inv-combobox-option.focused { background: var(--surface2); }
.inv-combobox-option.selected { background: var(--orange-dim); }
.inv-combobox-option:last-child { margin-bottom: 0; }
.inv-combo-name {
  font-weight: 700; font-size: 14px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.inv-combo-meta {
  font-size: 11px; color: var(--muted2);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.inv-combo-badge {
  display: inline-block; font-size: 9px; font-weight: 700;
  letter-spacing: 0.8px; text-transform: uppercase;
  padding: 1px 6px; border-radius: 4px; flex-shrink: 0;
}
.inv-combo-badge.ok  { background: rgba(22,163,74,0.12); color: var(--green); border: 1px solid rgba(22,163,74,0.25); }
.inv-combo-badge.low { background: rgba(245,158,11,0.12); color: #b45309; border: 1px solid rgba(245,158,11,0.3); }
.inv-combo-badge.out { background: rgba(220,38,38,0.10); color: var(--red); border: 1px solid rgba(220,38,38,0.2); }
.inv-combo-compat {
  font-size: 10px; color: var(--muted); font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.inv-combobox-empty {
  text-align: center; padding: 20px 12px;
  color: var(--muted); font-size: 13px;
}

@media (max-width: 768px) {
  .inv-combobox-trigger { padding: 13px 36px 13px 14px; font-size: 16px; }
  .inv-combobox-list { max-height: 220px; }
}
/* ══════════════════════════════════════════════════════════════
   RETAIL MODULE STYLES
   ══════════════════════════════════════════════════════════════ */

/* ── Field hint (small helper text below inputs) ── */
.field-hint {
  font-size: 11px;
  color: var(--muted2);
  margin-top: 4px;
  line-height: 1.5;
}

/* ── Card tabs (Add / Restock / Edit / List) ── */
.card-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.card-tabs .btn.active-tab {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

/* ── Retail cart totals box ── */
.totals-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted2);
  padding: 4px 0;
}
.total-row.grand-total {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}
.total-row.grand-total span:last-child {
  color: var(--orange);
}

/* ── Retail nav badge (Retail section label same style) ── */
.nav-section-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 18px 4px;
  margin-top: 4px;
}

/* ── Accessory & parts inventory list table tweaks ── */
#accInvListBody td,
#invPartsListBody td {
  padding: 9px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
#accInvListBody tr:last-child td,
#invPartsListBody tr:last-child td { border-bottom: none; }

/* ── Billing/Retail dropdown items ── */
.inv-combobox-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
  -webkit-tap-highlight-color: transparent;
  border: 1px solid transparent;
}
.inv-combobox-item:hover { background: var(--surface2); border-color: var(--border); }
.inv-combobox-item.selected { background: var(--orange-dim); border-color: var(--orange); }
.inv-combobox-item:last-child { margin-bottom: 0; }
.inv-combobox-item-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.inv-combobox-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-combobox-item-sub {
  font-size: 11px;
  color: var(--muted2);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.inv-combobox-item-right {
  flex-shrink: 0;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}
.inv-combobox-item-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.inv-combobox-item-stock {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 99px;
  white-space: nowrap;
}
.inv-combobox-item-stock.ok  { background: rgba(22,163,74,0.12); color: var(--green); }
.inv-combobox-item-stock.low { background: rgba(245,158,11,0.12); color: #b45309; }
.inv-combobox-item-stock.out { background: rgba(220,38,38,0.10); color: var(--red); }
.inv-combobox-item-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--orange);
  background: var(--orange-dim);
  padding: 1px 6px;
  border-radius: 4px;
}
/* ── Disabled combobox item ── */
.inv-combobox-item.disabled {
  cursor: not-allowed;
  opacity: 0.45;
  pointer-events: none;
}

/* ── Mobile responsive tweaks for retail ── */
@media (max-width: 600px) {
  .card-tabs { gap: 6px; }
  .card-tabs .btn { font-size: 12px; padding: 7px 10px; }
  .total-row.grand-total { font-size: 14px; }
  #retailBillModalSub { font-size: 11px; }
}

/* ══════════════════════════════════════════════════════════════
   UNIFIED BILLING PAGE STYLES
   ══════════════════════════════════════════════════════════════ */

/* ── Mode selector card ── */
.billing-mode-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px 18px;
  margin-bottom: 16px;
}
.billing-mode-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted2);
  margin-bottom: 12px;
}

/* ── Mode pills ── */
.billing-mode-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.billing-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 2px solid var(--border);
  border-radius: 50px;
  background: var(--surface2);
  color: var(--muted2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  user-select: none;
}
.billing-pill:hover {
  border-color: var(--orange);
  color: var(--orange);
  background: rgba(224, 28, 28,0.05);
}
.billing-pill.active {
  border-color: var(--orange);
  background: var(--orange);
  color: #fff;
  box-shadow: 0 2px 8px rgba(224, 28, 28,0.28);
}
.billing-pill-icon {
  font-size: 16px;
  line-height: 1;
}
.billing-pill-text {
  line-height: 1;
}

/* ── Free service toggle (billing page variant) ── */
.free-svc-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 4px;
}
.free-svc-toggle button {
  padding: 7px 20px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface2);
  border: none;
  color: var(--muted2);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.free-svc-toggle button.active {
  background: var(--orange);
  color: #fff;
}
.free-svc-toggle button + button {
  border-left: 1px solid var(--border);
}

/* ── Charge hint text ── */
#b-chargeHint {
  font-size: 11px;
  color: var(--muted2);
  margin-top: 1px;
}

/* ── Mobile responsiveness ── */
@media (max-width: 520px) {
  .billing-mode-pills { gap: 8px; }
  .billing-pill { padding: 9px 14px; font-size: 12px; }
  .billing-pill-icon { font-size: 14px; }
  .billing-mode-card { padding: 14px 14px 16px; }
}

/* ══════════════════════════════════════════════════════════════════
   BILLING MODULE — PARTS & ACCESSORIES LIST  (new unified UI)
   ══════════════════════════════════════════════════════════════════ */

/* ── Empty state placeholder ── */
.b-empty-list {
  color: var(--muted);
  font-size: 13px;
  padding: 14px 0 6px;
  text-align: center;
  font-style: italic;
  letter-spacing: 0.2px;
}

/* ── List item card ── */
.b-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 7px;
  animation: slideIn 0.16s ease both;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}
.b-list-item:last-child { margin-bottom: 0; }
.b-list-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--orange);
  border-radius: 10px 0 0 10px;
  opacity: 0.5;
}
.b-list-item:hover {
  border-color: rgba(224,28,28,0.25);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ── Item body (name + meta) ── */
.b-list-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.b-list-item-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.1px;
}
.b-list-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.b-list-qty-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted2);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 7px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.b-list-subtotal {
  font-size: 12px;
  font-weight: 700;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── Item action buttons (edit + remove) ── */
.b-list-item-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.b-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface2);
  color: var(--muted2);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.13s, border-color 0.13s, color 0.13s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  flex-shrink: 0;
  line-height: 1;
}
.b-icon-btn:hover {
  background: var(--surface3);
  border-color: var(--orange);
  color: var(--orange);
}
.b-icon-btn.danger {
  color: var(--red);
  background: rgba(220,38,38,0.06);
  border-color: rgba(220,38,38,0.2);
}
.b-icon-btn.danger:hover {
  background: rgba(220,38,38,0.14);
  border-color: var(--red);
  color: var(--red);
}
.b-icon-btn:active { transform: scale(0.92); }

/* ── Section totals footer ── */
.b-section-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
  margin-top: 8px;
}
.b-section-total-label {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--muted2);
}
.b-section-total-value {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ── Grand total bar (billing page) ── */
.b-grand-total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(224,28,28,0.08);
  border: 1px solid rgba(224,28,28,0.22);
  border-radius: 10px;
  padding: 14px 18px;
  margin-top: 10px;
}
.b-grand-total-label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--orange);
}
.b-grand-total-value {
  font-family: var(--font-header);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: 1px;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}

/* ── Add row (part/accessory picker + qty inline) ── */
.b-add-row {
  display: grid;
  grid-template-columns: 1fr 90px auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}
.b-add-row .field-group { margin-bottom: 0; }

/* ── Part stock warning text ── */
#b-partStockWarning {
  font-size: 11px;
  font-weight: 600;
  min-height: 16px;
  margin-top: 4px;
  letter-spacing: 0.2px;
  transition: color 0.2s;
}

/* ── Retail product hint text ── */
#b-retailProductHint {
  font-size: 11px;
  color: var(--muted2);
  margin-top: 4px;
  min-height: 16px;
  font-weight: 600;
}

/* ── Odometer upload inline states ── */
#b-odometerStateWrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface2);
  display: none;
}
.b-odometer-state-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.b-odometer-progress-bar-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.b-odometer-progress-bar-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 99px;
  transition: width 0.4s ease;
  width: 0%;
}
.b-odometer-state-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted2);
  white-space: nowrap;
}
.b-odometer-done-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.b-odometer-error-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--red);
  flex: 1;
}

/* ── Mobile: collapse add-row to stacked ── */
@media (max-width: 600px) {
  .b-add-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .b-add-row > .field-group:last-child {
    display: flex;
    justify-content: flex-end;
  }
  .b-grand-total-value { font-size: 24px; }
  .b-list-item-name    { font-size: 12px; }
  .b-list-qty-badge    { font-size: 10px; }
  .b-list-subtotal     { font-size: 11px; }
  .b-icon-btn          { width: 34px; height: 34px; font-size: 14px; }
}

/* ── Very small screens ── */
@media (max-width: 380px) {
  .b-list-item    { padding: 9px 10px; gap: 7px; }
  .b-grand-total-value { font-size: 22px; }
}
