/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  /* Prevent iOS bounce scroll on the root */
  height: 100%;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  min-height: 100vh;
  height: 100%;
  overflow-x: hidden;
  /* iOS tap highlight removal */
  -webkit-tap-highlight-color: transparent;
}
/* iOS: prevent tap delay on all interactive elements */
button, a, input, select, textarea, [onclick] {
  touch-action: manipulation;
}
/* iOS: inputs must be ≥16px to prevent auto-zoom */
input, select, textarea {
  font-size: 16px !important;
}
/* iOS safe area padding for bottom nav (notch phones) */
.bottom-nav {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.main-content {
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}

/* ===== SCREENS ===== */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ===== PIN SCREENS ===== */
#pin-setup-screen, #pin-login-screen {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.pin-card {
  background: white;
  border-radius: 20px;
  padding: 32px 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.pin-logo { font-size: 48px; margin-bottom: 12px; }
.pin-card h2 { font-size: 1.4rem; color: #1e3a8a; margin-bottom: 6px; font-weight: 700; }
.pin-card p { font-size: 0.875rem; color: #64748b; margin-bottom: 24px; }
.pin-dots {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 28px;
}
.pin-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: white;
  transition: all 0.2s;
}
.pin-dot.filled { background: #1e3a8a; border-color: #1e3a8a; }
.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.pin-key {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 56px;
  display: flex; align-items: center; justify-content: center;
}
.pin-key:active, .pin-key:hover { background: #e2e8f0; }
.pin-key.del { background: #fee2e2; color: #dc2626; border-color: #fecaca; }
.pin-key.del:hover { background: #fecaca; }
.pin-error { color: #dc2626; font-size: 0.875rem; margin-top: 12px; min-height: 20px; }
.pin-biometric-btn {
  margin-top: 16px;
  background: none;
  border: none;
  color: #1e3a8a;
  font-size: 0.875rem;
  cursor: pointer;
  padding: 8px;
  display: flex; align-items: center; gap: 6px; justify-content: center;
  width: 100%;
}

/* ===== APP LAYOUT ===== */
#app-screen { background: #f1f5f9; }
.app-header {
  background: #1e3a8a;
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.app-header h1 { font-size: 1.1rem; font-weight: 700; }
.app-header .header-date { font-size: 0.75rem; opacity: 0.8; }
.header-actions { display: flex; gap: 8px; }
.header-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  transition: background 0.2s;
}
.header-btn:hover { background: rgba(255,255,255,0.25); }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: white;
  border-top: 1px solid #e2e8f0;
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
}
.nav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 4px;
  cursor: pointer;
  color: #94a3b8;
  font-size: 0.625rem;
  font-weight: 500;
  gap: 2px;
  transition: color 0.2s;
  border: none; background: none;
  min-height: 56px;
}
.nav-item i { font-size: 1.1rem; }
.nav-item.active { color: #1e3a8a; }
.nav-item:hover { color: #1e40af; }

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  padding: 16px;
  padding-bottom: 80px;
  overflow-y: auto;
}

/* ===== VIEWS ===== */
.view { display: none; }
.view.active { display: block; }

/* ===== DASHBOARD ===== */
.dashboard-greeting { font-size: 1rem; font-weight: 600; color: #1e293b; margin-bottom: 4px; }
.dashboard-date { font-size: 0.8rem; color: #64748b; margin-bottom: 16px; }
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: white;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.stat-card.full { grid-column: span 2; }
.stat-label { font-size: 0.7rem; color: #64748b; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: #1e293b; margin-top: 4px; }
.stat-value.green { color: #16a34a; }
.stat-value.red { color: #dc2626; }
.stat-value.blue { color: #1e3a8a; }
.stat-icon { font-size: 1.1rem; float: right; opacity: 0.3; }

.quick-actions { display: flex; gap: 12px; margin-bottom: 16px; }
.quick-btn {
  flex: 1; padding: 14px; border: none; border-radius: 14px;
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform 0.15s, box-shadow 0.15s;
  min-height: 48px;
}
.quick-btn:active { transform: scale(0.97); }
.quick-btn.primary { background: #1e3a8a; color: white; box-shadow: 0 4px 12px rgba(30,58,138,0.3); }
.quick-btn.secondary { background: #f59e0b; color: white; box-shadow: 0 4px 12px rgba(245,158,11,0.3); }

.section-title {
  font-size: 0.85rem; font-weight: 700; color: #64748b;
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.recent-list { display: flex; flex-direction: column; gap: 8px; }

/* ===== CARDS ===== */
.card {
  background: white;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  display: flex; align-items: center; gap: 12px;
}
.card-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.card-icon.sale { background: #dbeafe; color: #1e40af; }
.card-icon.expense { background: #fee2e2; color: #dc2626; }
.card-icon.udhaar { background: #fef3c7; color: #d97706; }
.card-body { flex: 1; min-width: 0; }
.card-title { font-size: 0.9rem; font-weight: 600; color: #1e293b; }
.card-sub { font-size: 0.75rem; color: #94a3b8; margin-top: 2px; }
.card-amount { font-size: 1rem; font-weight: 700; white-space: nowrap; }
.card-amount.green { color: #16a34a; }
.card-amount.red { color: #dc2626; }
.card-amount.orange { color: #d97706; }
.card-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.badge {
  font-size: 0.65rem; padding: 2px 7px; border-radius: 20px; font-weight: 600;
}
.badge.cash { background: #d1fae5; color: #059669; }
.badge.udhaar { background: #fef3c7; color: #92400e; }
.badge.card { background: #dbeafe; color: #1e40af; }
.badge.online { background: #f3e8ff; color: #7c3aed; }

/* ===== FAB ===== */
.fab {
  position: fixed;
  bottom: 76px; right: 20px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #1e3a8a;
  color: white;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(30,58,138,0.4);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 90;
}
.fab:active { transform: scale(0.92); box-shadow: 0 2px 8px rgba(30,58,138,0.4); }
.fab.expense-fab { background: #dc2626; box-shadow: 0 4px 16px rgba(220,38,38,0.4); }

/* ===== LIST VIEWS ===== */
.list-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.list-title { font-size: 1.1rem; font-weight: 700; color: #1e293b; }
.list-total { font-size: 0.8rem; color: #64748b; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #94a3b8;
}
.empty-state i { font-size: 3rem; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 0.9rem; }

/* ===== CUSTOMERS ===== */
.customer-card {
  background: white;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 8px;
  cursor: pointer;
  transition: box-shadow 0.2s;
  border-left: 4px solid #e2e8f0;
}
.customer-card:active { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.customer-card.due-red { border-left-color: #dc2626; }
.customer-card.due-orange { border-left-color: #f59e0b; }
.customer-card.due-green { border-left-color: #16a34a; }
.customer-name { font-size: 0.95rem; font-weight: 600; color: #1e293b; }
.customer-mobile { font-size: 0.75rem; color: #94a3b8; margin-top: 2px; }
.customer-due { font-size: 1.1rem; font-weight: 700; }
.customer-due.red { color: #dc2626; }
.customer-due.orange { color: #d97706; }
.customer-due.green { color: #16a34a; }
.customer-due-label { font-size: 0.7rem; color: #94a3b8; }

/* ===== STAFF ===== */
.staff-card {
  background: white;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 14px;
}
.staff-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #dbeafe;
  color: #1e40af;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700; flex-shrink: 0;
}
.staff-info { flex: 1; }
.staff-name { font-size: 0.95rem; font-weight: 600; color: #1e293b; }
.staff-wage { font-size: 0.75rem; color: #64748b; margin-top: 2px; }
.staff-month-due { font-size: 0.85rem; font-weight: 700; color: #1e3a8a; }
/* attendance-toggle styles moved to Staff Card V2 section */

/* ===== REPORTS ===== */
.report-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 12px;
}
.report-card h3 { font-size: 0.85rem; font-weight: 700; color: #64748b; margin-bottom: 14px; text-transform: uppercase; letter-spacing: 0.5px; }
.report-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9rem;
}
.report-row:last-child { border-bottom: none; }
.report-row .label { color: #64748b; }
.report-row .value { font-weight: 600; color: #1e293b; }
.report-row .value.green { color: #16a34a; }
.report-row .value.red { color: #dc2626; }
.report-row .value.blue { color: #1e3a8a; }

/* ===== MODALS ===== */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px 20px;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-handle {
  width: 40px; height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  margin: 0 auto 20px;
}
.modal h2 { font-size: 1.1rem; font-weight: 700; color: #1e293b; margin-bottom: 20px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-label { font-size: 0.8rem; font-weight: 600; color: #374151; margin-bottom: 6px; display: block; }
.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  color: #1e293b;
  background: white;
  transition: border-color 0.2s;
  min-height: 48px;
}
.form-input:focus { outline: none; border-color: #1e3a8a; }
.form-select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  color: #1e293b;
  background: white;
  min-height: 48px;
  -webkit-appearance: none;
}
.form-select:focus { outline: none; border-color: #1e3a8a; }

/* ===== AMOUNT INPUT ===== */
.amount-display {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 16px;
  min-height: 72px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 1px;
}
.amount-display.has-value { color: #1e3a8a; }

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.numpad-key {
  padding: 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  background: #f8fafc;
  color: #1e293b;
  min-height: 54px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s;
}
.numpad-key:active { background: #e2e8f0; }
.numpad-key.del { background: #fee2e2; color: #dc2626; border-color: #fecaca; }
.numpad-key.zero { grid-column: span 2; }

/* ===== PAYMENT MODE PILLS ===== */
.mode-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.mode-pill {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid #e2e8f0;
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer;
  background: white;
  color: #64748b;
  transition: all 0.15s;
  min-height: 36px;
}
.mode-pill.active { background: #1e3a8a; color: white; border-color: #1e3a8a; }

/* ===== TOGGLE ===== */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
}
.toggle-label { font-size: 0.9rem; font-weight: 500; color: #1e293b; }
.toggle-sub { font-size: 0.75rem; color: #94a3b8; }
.toggle-switch {
  width: 50px; height: 28px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  position: relative;
  background: #e2e8f0;
  flex-shrink: 0;
  transition: background 0.2s;
}
.toggle-switch.on { background: #1e3a8a; }
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 4px; left: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: white;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch.on::after { left: 26px; }

/* ===== BUTTONS ===== */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 20px;
  border: none; border-radius: 12px;
  font-size: 0.95rem; font-weight: 600;
  cursor: pointer; width: 100%;
  min-height: 50px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: #1e3a8a; color: white; box-shadow: 0 4px 12px rgba(30,58,138,0.25); }
.btn-primary:hover { background: #1e40af; }
.btn-danger { background: #dc2626; color: white; box-shadow: 0 4px 12px rgba(220,38,38,0.25); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: #16a34a; color: white; box-shadow: 0 4px 12px rgba(22,163,74,0.25); }
.btn-warning { background: #f59e0b; color: white; box-shadow: 0 4px 12px rgba(245,158,11,0.25); }
.btn-outline { background: white; color: #1e3a8a; border: 1.5px solid #1e3a8a; }
.btn-ghost { background: #f1f5f9; color: #64748b; }
.btn-sm { padding: 8px 14px; min-height: 36px; font-size: 0.8rem; border-radius: 8px; width: auto; }

/* ===== TOAST ===== */
#toast-container {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%);
  z-index: 500; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: #1e293b; color: white;
  padding: 10px 20px; border-radius: 24px;
  font-size: 0.85rem; font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  animation: toastIn 0.3s ease;
  pointer-events: none;
}
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
.toast.warning { background: #d97706; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }

/* ===== INSTALL BANNER ===== */
#install-banner {
  display: none;
  position: fixed; bottom: 70px; left: 12px; right: 12px;
  background: #1e3a8a; color: white;
  border-radius: 16px; padding: 14px 16px;
  z-index: 150;
  box-shadow: 0 8px 24px rgba(30,58,138,0.4);
  flex-direction: column; gap: 10px;
}
#install-banner.show { display: flex; }
.install-banner-row { display: flex; align-items: center; gap: 10px; }
.install-banner-icon { font-size: 1.5rem; }
.install-banner-text { flex: 1; font-size: 0.85rem; }
.install-banner-text strong { display: block; font-size: 0.95rem; }
.install-banner-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ===== CUSTOMER DETAIL ===== */
.cust-header {
  background: linear-gradient(135deg, #1e3a8a, #1e40af);
  color: white; padding: 20px;
  border-radius: 16px; margin-bottom: 16px;
}
.cust-header h2 { font-size: 1.2rem; font-weight: 700; }
.cust-header p { font-size: 0.8rem; opacity: 0.8; margin-top: 4px; }
.cust-due-big { font-size: 2rem; font-weight: 700; margin-top: 8px; }
.cust-action-btns { display: flex; gap: 10px; margin-bottom: 16px; }

/* ===== CLOSURE ===== */
.closure-summary {
  background: #f8fafc;
  border-radius: 14px; padding: 16px; margin-bottom: 16px;
}
.closure-row {
  display: flex; justify-content: space-between;
  padding: 6px 0; font-size: 0.9rem;
}
.closure-total {
  border-top: 2px solid #e2e8f0;
  margin-top: 8px; padding-top: 8px;
  font-weight: 700;
}

/* ===== SETTINGS ===== */
.settings-section {
  background: white; border-radius: 16px;
  overflow: hidden; margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.settings-section-title {
  padding: 12px 16px;
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
}
.settings-item {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 56px;
  cursor: pointer;
}
.settings-item:last-child { border-bottom: none; }
.settings-item-left { display: flex; align-items: center; gap: 12px; }
.settings-item-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
}
.settings-item-label { font-size: 0.9rem; font-weight: 500; color: #1e293b; }
.settings-item-sub { font-size: 0.75rem; color: #94a3b8; margin-top: 2px; }
.settings-item-right { color: #94a3b8; font-size: 0.8rem; display: flex; align-items: center; gap: 6px; }

/* ===== PDF EXPORT HIDDEN DIV ===== */
#pdf-content {
  position: absolute; left: -9999px; top: 0;
  width: 380px; background: white; padding: 24px;
  font-family: -apple-system, sans-serif;
}

/* ===== CUSTOMER CARD ACTION BUTTONS ===== */
.customer-card-actions {
  display: flex; gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}
.cca-btn {
  flex: 1; padding: 9px 10px;
  border-radius: 10px; border: none;
  font-size: 0.78rem; font-weight: 600;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center; gap: 6px;
  transition: opacity 0.15s;
}
.cca-btn:active { opacity: 0.75; }
.cca-btn.pay      { background: #f0fdf4; color: #16a34a; }
.cca-btn.whatsapp { background: #f0fdf4; color: #25d366; border: 1.5px solid #bbf7d0; }
.cca-btn.whatsapp i { font-size: 1rem; }

/* ===== WHATSAPP REMINDER MODAL ===== */
.wa-modal-header {
  display: flex; align-items: center; gap: 12px;
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 14px; padding: 14px 16px;
  margin-bottom: 20px;
}
.wa-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: #25d366; color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.wa-title    { font-size: 1rem; font-weight: 700; color: #1e293b; }
.wa-subtitle { font-size: 0.72rem; color: #64748b; margin-top: 2px; }
.wa-due-val  { font-size: 1.1rem; font-weight: 700; }
.wa-due-val.red    { color: #dc2626; }
.wa-due-val.orange { color: #d97706; }
.wa-due-val.green  { color: #16a34a; }

.wa-code-prefix {
  background: #f1f5f9; border: 1.5px solid #e2e8f0;
  border-radius: 10px; padding: 0 12px;
  font-size: 0.9rem; font-weight: 600; color: #64748b;
  min-height: 48px; display: flex; align-items: center;
  white-space: nowrap; flex-shrink: 0;
}

.wa-template-row {
  display: flex; gap: 8px;
}
.wa-template-btn {
  flex: 1; padding: 8px 6px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.75rem; font-weight: 600;
  cursor: pointer; background: #f8fafc; color: #64748b;
  transition: all 0.15s;
}
.wa-template-btn.active {
  background: #f0fdf4; border-color: #86efac; color: #16a34a;
}

.wa-message-box {
  resize: none; line-height: 1.6;
  font-size: 0.88rem; color: #374151;
  min-height: 120px;
}

.wa-send-btn {
  background: #25d366; color: white;
  font-size: 1rem; font-weight: 700;
  box-shadow: 0 4px 14px rgba(37,211,102,0.4);
  gap: 8px;
}
.wa-send-btn i { font-size: 1.2rem; }
.wa-send-btn:hover { background: #22c55e; }

/* ===== TAPPABLE SALE CARD ===== */
.card-tappable {
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
}
.card-tappable:active {
  transform: scale(0.98);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* ===== EDIT HINT BANNER ===== */
.edit-hint {
  display: flex; align-items: center; gap: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.78rem;
  color: #1e40af;
  margin-bottom: 12px;
}
.edit-hint.locked {
  background: #fef9c3;
  border-color: #fde68a;
  color: #92400e;
}

/* ===== SALES VIEW TOGGLE ===== */
.view-toggle-bar {
  display: flex; gap: 6px;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 4px;
}
.sales-view-tab {
  flex: 1; padding: 8px 12px;
  border: none; border-radius: 9px;
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; color: #64748b;
  background: transparent;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.sales-view-tab.active {
  background: white; color: #1e3a8a;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* ===== GROUPED SALE CARD (Summary View) ===== */
.grouped-sale-card {
  background: white;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  display: flex; align-items: center;
  margin-bottom: 8px;
  border-left: 3px solid #1e3a8a;
}
.gs-left  { flex: 1; min-width: 0; }
.gs-right { text-align: right; flex-shrink: 0; }
.gs-name  { font-size: 0.95rem; font-weight: 600; color: #1e293b; margin-bottom: 4px; }
.gs-meta  { display: flex; gap: 5px; flex-wrap: wrap; }
.gs-amount { font-size: 1.05rem; font-weight: 700; color: #16a34a; }
.gs-qty    { font-size: 0.72rem; color: #94a3b8; margin-top: 2px; }

/* ===== SALE MODE TABS (inside modal) ===== */
.sale-mode-tabs {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 14px;
  background: #f1f5f9; border-radius: 12px; padding: 4px;
}
.sale-mode-tab {
  flex: 1; padding: 8px 10px;
  border: none; border-radius: 9px;
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; color: #64748b;
  background: transparent;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.sale-mode-tab.active {
  background: white; color: #1e3a8a;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* ===== QUICK ITEMS GRID ===== */
.quick-items-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
  max-height: 200px;
  overflow-y: auto;
  padding: 2px;
}
.quick-item-chip {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  display: flex; flex-direction: column; gap: 3px;
  min-height: 58px; align-items: center; justify-content: center;
}
.quick-item-chip:active { transform: scale(0.96); }
.quick-item-chip.selected {
  background: #dbeafe; border-color: #1e40af;
}
.qi-name  { font-size: 0.78rem; font-weight: 600; color: #1e293b; line-height: 1.2; }
.qi-price { font-size: 0.7rem; color: #64748b; font-weight: 500; }
.quick-item-chip.selected .qi-name  { color: #1e3a8a; }
.quick-item-chip.selected .qi-price { color: #1e40af; }

/* ===== QUANTITY SELECTOR ===== */
.qi-selection-box {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}
.qi-item-name-display {
  font-size: 0.95rem; font-weight: 700; color: #1e293b;
  margin-bottom: 4px; text-align: center;
}
.qi-unit-price {
  font-size: 0.75rem; color: #94a3b8;
  text-align: center; margin-bottom: 10px; min-height: 16px;
}
.qi-qty-row {
  display: flex; align-items: center; justify-content: center;
  gap: 12px;
}
.qty-btn {
  width: 38px; height: 38px;
  border-radius: 50%; border: 1.5px solid #e2e8f0;
  background: white; cursor: pointer;
  color: #1e3a8a; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.qty-btn:active { background: #dbeafe; }
.qty-display {
  font-size: 1.4rem; font-weight: 700; color: #1e293b;
  min-width: 36px; text-align: center;
}
.qi-equals { font-size: 1rem; color: #94a3b8; }
.qi-total-val {
  font-size: 1.5rem; font-weight: 700; color: #94a3b8;
}
.qi-total-val.has-value { color: #1e3a8a; }

/* ===== ITEMS MANAGER ===== */
.add-item-form {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 16px;
}
.add-item-form .form-input { min-height: 44px; }
.item-row {
  display: flex; align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid #f1f5f9;
}
.item-row:last-child { border-bottom: none; }
.item-row-info { flex: 1; }
.item-row-name { font-size: 0.9rem; font-weight: 600; color: #1e293b; }
.item-row-meta { font-size: 0.72rem; color: #94a3b8; margin-top: 2px; }
.item-delete-btn {
  width: 34px; height: 34px;
  border-radius: 50%; border: none;
  background: #fee2e2; color: #dc2626;
  cursor: pointer; font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.item-delete-btn:hover { background: #fecaca; }

/* ===== HELP MODAL ===== */
.help-fullscreen {
  align-items: flex-start !important;
}
.help-panel {
  background: #f8fafc;
  width: 100%; max-width: 480px;
  height: 100vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease;
}

/* Header */
.help-header {
  background: linear-gradient(135deg, #1e3a8a, #1e40af);
  padding: 16px 16px 14px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
}
.help-header-left { display: flex; align-items: center; gap: 12px; }
.help-icon { font-size: 1.8rem; line-height: 1; }
.help-title    { font-size: 1.1rem; font-weight: 700; color: white; }
.help-subtitle { font-size: 0.72rem; color: rgba(255,255,255,0.75); margin-top: 2px; }
.help-close-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.15); border: none;
  color: white; font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* Search */
.help-search-wrap {
  position: relative;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.help-search-icon {
  position: absolute; left: 28px; top: 50%;
  transform: translateY(-50%); color: #94a3b8; font-size: 0.85rem;
}
.help-search-input {
  width: 100%; padding: 10px 14px 10px 36px;
  border: 1.5px solid #e2e8f0; border-radius: 10px;
  font-size: 16px; color: #1e293b; background: #f8fafc;
}
.help-search-input:focus { outline: none; border-color: #1e3a8a; }

/* Scrollable content */
.help-content {
  flex: 1; overflow-y: auto;
  padding: 12px 16px 40px;
}

/* Section */
.help-section { margin-bottom: 20px; }
.help-section-title {
  font-size: 0.78rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 8px; padding-left: 2px;
}

/* Q&A item */
.help-item {
  background: white;
  border-radius: 12px;
  margin-bottom: 6px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  border: 1px solid #f1f5f9;
}
.help-q {
  width: 100%; text-align: left;
  padding: 14px 16px;
  background: none; border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 0.88rem; font-weight: 600; color: #1e293b;
  line-height: 1.4;
}
.help-q span { flex: 1; }
.help-chevron {
  font-size: 0.72rem; color: #94a3b8;
  transition: transform 0.25s; flex-shrink: 0;
}
.help-item.open .help-chevron { transform: rotate(180deg); }

.help-a {
  max-height: 0; overflow: hidden;
  transition: max-height 0.3s ease, padding 0.2s ease;
  font-size: 0.84rem; line-height: 1.65; color: #475569;
  padding: 0 16px;
  border-top: 0px solid #f1f5f9;
}
.help-item.open .help-a {
  max-height: 500px;
  padding: 12px 16px 16px;
  border-top: 1px solid #f1f5f9;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.divider { height: 1px; background: #f1f5f9; margin: 12px 0; }
.fw-700 { font-weight: 700; }
.text-sm { font-size: 0.8rem; }
.text-muted { color: #94a3b8; }

/* ===== CLOSED DAY BADGE ===== */
.day-closed-banner {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 0.82rem;
  color: #92400e;
  display: flex; align-items: center; gap: 8px;
}

/* ===== STAFF SUMMARY BANNER ===== */
.staff-summary-card {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(30,58,138,0.3);
}
.staff-summary-item { text-align: center; }
.ss-value { font-size: 1.15rem; font-weight: 700; color: white; }
.ss-value.paid { color: #86efac; }
.ss-value.due  { color: #fcd34d; }
.ss-label { font-size: 0.68rem; color: rgba(255,255,255,0.7); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.4px; }
.staff-summary-divider { width: 1px; height: 36px; background: rgba(255,255,255,0.2); }

/* ===== STAFF CARD V2 ===== */
.staff-card-v2 {
  background: white;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  border: 1px solid #f1f5f9;
}
.staff-card-top {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.staff-avatar-v2 {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700; flex-shrink: 0;
}
.staff-info-v2 { flex: 1; }
.staff-name-v2 { font-size: 1rem; font-weight: 700; color: #1e293b; }
.staff-rate { font-size: 0.8rem; color: #64748b; margin-top: 2px; }
.staff-rate span { font-size: 0.7rem; }
.staff-detail-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none; cursor: pointer;
  color: #64748b;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  transition: background 0.2s;
}
.staff-detail-btn:hover { background: #dbeafe; color: #1e40af; }

/* Attendance progress bar */
.att-bar-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.att-bar-label { font-size: 0.75rem; color: #64748b; }
.att-pct { font-size: 0.75rem; font-weight: 700; }
.att-pct.green  { color: #16a34a; }
.att-pct.orange { color: #d97706; }
.att-pct.red    { color: #dc2626; }
.att-progress-track {
  height: 6px; background: #e2e8f0;
  border-radius: 3px; overflow: hidden;
  margin-bottom: 14px;
}
.att-progress-fill {
  height: 100%; border-radius: 3px;
  transition: width 0.4s ease;
}
.att-progress-fill.green  { background: #16a34a; }
.att-progress-fill.orange { background: #f59e0b; }
.att-progress-fill.red    { background: #dc2626; }

/* Salary pills */
.salary-pills {
  display: flex; gap: 8px;
  margin-bottom: 14px;
}
.salary-pill {
  flex: 1; border-radius: 12px; padding: 10px 8px;
  text-align: center; border: 1.5px solid #e2e8f0;
}
.salary-pill.earned  { background: #f8fafc; }
.salary-pill.paid    { background: #f0fdf4; border-color: #bbf7d0; }
.salary-pill.due     { background: #f8fafc; }
.salary-pill.due.highlight { background: #fffbeb; border-color: #fde68a; }
.pill-label { font-size: 0.65rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 3px; }
.pill-value { font-size: 0.95rem; font-weight: 700; color: #1e293b; }
.salary-pill.paid .pill-value    { color: #16a34a; }
.salary-pill.due.highlight .pill-value { color: #d97706; }

/* Card footer */
.staff-card-footer {
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.att-today-row { display: flex; align-items: center; gap: 10px; }
.att-today-label { font-size: 0.78rem; color: #64748b; white-space: nowrap; }

/* Re-style attendance toggle to show text */
.attendance-toggle {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.78rem; font-weight: 600;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc; color: #94a3b8;
  cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
}
.attendance-toggle.present {
  background: #f0fdf4; border-color: #86efac; color: #16a34a;
}
.pay-now-btn {
  padding: 8px 14px;
  background: #fffbeb; border: 1.5px solid #fde68a;
  border-radius: 20px; font-size: 0.78rem; font-weight: 600;
  color: #92400e; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
  transition: background 0.2s;
}
.pay-now-btn:hover { background: #fef3c7; }
.paid-badge {
  font-size: 0.75rem; color: #16a34a; font-weight: 600;
  display: flex; align-items: center; gap: 5px;
}

/* ===== STAFF DETAIL MODAL ===== */
.sd-header {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, #1e3a8a, #1e40af);
  border-radius: 16px; padding: 16px;
  margin-bottom: 16px;
}
.sd-avatar {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 700;
  flex-shrink: 0;
}
.sd-avatar-wrap {}
.sd-header-info {}
.sd-name { font-size: 1.1rem; font-weight: 700; color: white; }
.sd-rate { font-size: 0.8rem; color: rgba(255,255,255,0.8); margin-top: 3px; }
.sd-month-badge {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  color: white; font-size: 0.7rem;
  padding: 2px 10px; border-radius: 10px; margin-top: 6px;
}

.sd-salary-row {
  display: flex; gap: 10px; margin-bottom: 8px;
}
.sd-pill {
  flex: 1; border-radius: 14px; padding: 14px 10px;
  text-align: center;
}
.sd-pill.earned  { background: #f8fafc; border: 1.5px solid #e2e8f0; }
.sd-pill.paid    { background: #f0fdf4; border: 1.5px solid #bbf7d0; }
.sd-pill.due     { background: #fffbeb; border: 1.5px solid #fde68a; }
.sd-pill-val { font-size: 1.05rem; font-weight: 700; color: #1e293b; }
.sd-pill.paid .sd-pill-val { color: #16a34a; }
.sd-pill.due  .sd-pill-val { color: #d97706; }
.sd-pill-lbl { font-size: 0.65rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.4px; margin-top: 4px; }

.sd-section-title {
  font-size: 0.8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: #64748b; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}

/* ===== ATTENDANCE CALENDAR ===== */
.att-calendar-legend {
  display: flex; gap: 14px; align-items: center;
  font-size: 0.72rem; color: #64748b;
  margin-bottom: 10px;
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%; display: inline-block; margin-right: 4px;
}
.legend-dot.present  { background: #16a34a; }
.legend-dot.absent   { background: #dc2626; }
.legend-dot.unmarked { background: #e2e8f0; }

.att-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-bottom: 4px;
}
.att-day-header {
  text-align: center; font-size: 0.65rem;
  font-weight: 700; color: #94a3b8; padding: 4px 0;
  text-transform: uppercase;
}
.att-day-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 600;
  cursor: pointer; border: none;
  transition: all 0.15s;
}
.att-day-cell.empty   { background: transparent; cursor: default; }
.att-day-cell.present { background: #dcfce7; color: #16a34a; }
.att-day-cell.absent  { background: #fee2e2; color: #dc2626; }
.att-day-cell.unmarked { background: #f1f5f9; color: #94a3b8; }
.att-day-cell.future  { background: transparent; color: #cbd5e1; cursor: default; }
.att-day-cell.is-today { box-shadow: 0 0 0 2px #1e3a8a; font-weight: 800; }
.att-day-cell.present:hover  { background: #bbf7d0; }
.att-day-cell.absent:hover   { background: #fecaca; }
.att-day-cell.unmarked:hover { background: #e2e8f0; }

/* ===== PAYMENT HISTORY ===== */
.pmt-history-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  background: white; border-radius: 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  border-left: 3px solid #16a34a;
}
.pmt-date { font-size: 0.78rem; font-weight: 600; color: #1e293b; }
.pmt-note { font-size: 0.72rem; color: #94a3b8; margin-top: 2px; }
.pmt-amount { font-size: 1rem; font-weight: 700; color: #16a34a; }

/* ===== MONTH SELECTOR ===== */
.month-selector {
  display: flex; align-items: center; justify-content: space-between;
  background: white; border-radius: 12px; padding: 10px 14px;
  margin-bottom: 14px; box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.month-nav-btn {
  background: none; border: none; cursor: pointer;
  color: #1e3a8a; font-size: 1rem; padding: 4px 8px;
  min-height: 36px;
}
.month-label { font-weight: 600; font-size: 0.95rem; color: #1e293b; }

/* ===== CURRENCY SELECTOR ===== */
.currency-option {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.currency-option:active { background: #f8fafc; }
.currency-option.selected { background: #eff6ff; }
.cur-flag { font-size: 1.6rem; line-height: 1; flex-shrink: 0; }
.cur-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cur-name { font-size: 0.88rem; font-weight: 600; color: #1e293b; line-height: 1.2; }
.cur-code { font-size: 0.75rem; color: #64748b; }
.cur-symbol { font-size: 1rem; font-weight: 700; color: #1e3a8a; flex-shrink: 0; }
.cur-check { font-size: 1rem; color: #1e3a8a; flex-shrink: 0; }
