/* ============================================
   BillMaster - Main Stylesheet
   Premium Mobile-First Billing Software
   ============================================ */

/* Google Font Import */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* CSS Variables */
:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #EFF6FF;
  --success: #10B981;
  --success-light: #ECFDF5;
  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --danger: #EF4444;
  --danger-light: #FEF2F2;
  --purple: #8B5CF6;
  --purple-light: #F5F3FF;
  --bg: #F8FAFC;
  --card-bg: #FFFFFF;
  --text-primary: #1E293B;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --nav-height: 70px;
  --header-height: 64px;
  --font: 'Poppins', sans-serif;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.bg-light { background: var(--bg); }

/* App Shell */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background: var(--bg);
}

/* ============================================
   HEADER
   ============================================ */
.app-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--header-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 100%;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  display: flex;
  align-items: center;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: var(--bg);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover, .icon-btn:active {
  background: var(--primary-light);
  color: var(--primary);
  transform: scale(0.95);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  padding-top: calc(var(--header-height) + 12px);
  padding-bottom: calc(var(--nav-height) + 20px);
  padding-left: 16px;
  padding-right: 16px;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero-section {
  margin-bottom: 16px;
}

.hero-card {
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 50%, #1E40AF 100%);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.35);
}

.hero-card::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -30px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}

.hero-card::after {
  content: '';
  position: absolute;
  bottom: -60px;
  right: 20px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}

.hero-greeting {
  font-size: 0.9rem;
  opacity: 0.85;
  font-weight: 400;
  margin-bottom: 4px;
}

.hero-business {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.hero-date {
  font-size: 0.8rem;
  opacity: 0.75;
  margin-bottom: 20px;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 1;
}

.hero-stat {
  flex: 1;
  text-align: center;
}

.hero-stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.hero-stat-label {
  font-size: 0.72rem;
  opacity: 0.8;
  font-weight: 400;
}

.hero-stat-divider {
  width: 1px;
  height: 36px;
  background: rgba(255,255,255,0.25);
}

/* ============================================
   CREATE BILL BUTTON
   ============================================ */
.create-bill-section {
  margin-bottom: 16px;
}

.create-bill-btn {
  width: 100%;
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  border: none;
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
  transition: all 0.2s;
  text-decoration: none;
}

.create-bill-btn:active {
  transform: scale(0.98);
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.3);
}

.create-bill-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.create-bill-text {
  flex: 1;
  text-align: left;
}

.create-bill-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: white;
  margin-bottom: 2px;
}

.create-bill-sub {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.8);
  font-weight: 400;
}

.create-bill-arrow {
  opacity: 0.8;
}

/* ============================================
   QUICK STATS
   ============================================ */
.quick-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
}

.stat-card:active {
  transform: scale(0.97);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-blue { background: var(--primary-light); color: var(--primary); }
.stat-icon-green { background: var(--success-light); color: var(--success); }
.stat-icon-orange { background: var(--warning-light); color: var(--warning); }
.stat-icon-purple { background: var(--purple-light); color: var(--purple); }

.stat-info { flex: 1; }
.stat-value { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 0.72rem; color: var(--text-secondary); font-weight: 400; }
.stat-arrow { color: var(--text-muted); font-size: 1rem; }

/* ============================================
   SECTION CARDS
   ============================================ */
.section-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.section-link {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}

.section-link:hover { background: var(--primary-light); }

/* ============================================
   RECENT BILLS
   ============================================ */
.recent-list { display: flex; flex-direction: column; gap: 10px; }

.bill-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
}

.bill-item:active { background: var(--primary-light); }

.bill-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.bill-info { flex: 1; }
.bill-customer { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.bill-meta { font-size: 0.73rem; color: var(--text-secondary); margin-top: 1px; }

.bill-right { text-align: right; }
.bill-amount { font-size: 0.95rem; font-weight: 700; color: var(--primary); }

.bill-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 600;
  margin-top: 2px;
}

.status-draft { background: var(--warning-light); color: var(--warning); }
.status-shared { background: var(--success-light); color: var(--success); }
.status-cancelled { background: var(--danger-light); color: var(--danger); }

/* ============================================
   QUICK ACTIONS
   ============================================ */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.quick-action:active { transform: scale(0.95); background: var(--primary-light); }

.qa-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.qa-blue { background: var(--primary-light); }
.qa-green { background: var(--success-light); }
.qa-orange { background: var(--warning-light); }
.qa-purple { background: var(--purple-light); }

.qa-label { font-size: 0.7rem; font-weight: 500; color: var(--text-secondary); }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state-small {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
}

.empty-icon { font-size: 2rem; margin-bottom: 8px; }
.empty-text { font-size: 0.85rem; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 3.5rem; margin-bottom: 16px; }
.empty-state-title { font-size: 1.1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-desc { font-size: 0.85rem; line-height: 1.5; }

/* ============================================
   INSTALL BANNER
   ============================================ */
.install-banner {
  background: linear-gradient(135deg, #1E293B 0%, #334155 100%);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.install-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.install-icon { font-size: 1.8rem; }

.install-title { font-size: 0.9rem; font-weight: 600; color: white; }
.install-sub { font-size: 0.72rem; color: rgba(255,255,255,0.7); margin-top: 2px; }

.install-actions { display: flex; gap: 8px; align-items: center; }

.btn-install {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
}

.btn-dismiss {
  color: rgba(255,255,255,0.6);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
}

/* ============================================
   BOTTOM NAVIGATION
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-height);
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-muted);
  transition: all 0.2s;
  border-radius: 12px;
  min-width: 60px;
  position: relative;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active .nav-icon {
  background: var(--primary-light);
  border-radius: 10px;
}

.nav-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 4px;
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 500;
}

.nav-create {
  position: relative;
  top: -8px;
}

.nav-create-btn {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
  transition: all 0.2s;
}

.nav-create:active .nav-create-btn {
  transform: scale(0.92);
}

/* ============================================
   PAGE HEADER (for sub-pages)
   ============================================ */
.page-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--header-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.page-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 100%;
}

.back-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  flex-shrink: 0;
  transition: all 0.2s;
}

.back-btn:active { background: var(--primary-light); color: var(--primary); }

.page-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.page-actions {
  display: flex;
  gap: 8px;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--card-bg);
  transition: all 0.2s;
  outline: none;
  -webkit-appearance: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder { color: var(--text-muted); }

.form-select {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--card-bg);
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: all 0.2s;
}

.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-input {
  resize: vertical;
  min-height: 90px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-warning {
  background: var(--warning);
  color: white;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-primary);
}

.btn-outline-primary {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}

.btn-full { width: 100%; }

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.btn-lg {
  padding: 16px 28px;
  font-size: 1rem;
  border-radius: 14px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover { background: var(--primary-light); color: var(--primary); }
.btn-icon.danger:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal-overlay.modal-center {
  align-items: center;
  padding: 20px;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-center .modal {
  border-radius: var(--radius-lg);
  animation: fadeIn 0.2s ease;
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.1rem;
  transition: all 0.2s;
}

.modal-close:hover { background: var(--danger-light); color: var(--danger); }

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--border);
}

/* ============================================
   SEARCH
   ============================================ */
.search-container {
  position: relative;
  margin-bottom: 16px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 13px 16px 13px 44px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--card-bg);
  outline: none;
  transition: all 0.2s;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ============================================
   LIST ITEMS (Products, Customers)
   ============================================ */
.list-container { display: flex; flex-direction: column; gap: 10px; }

.list-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.list-item:active { transform: scale(0.99); }

.list-item-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.list-item-info { flex: 1; min-width: 0; }
.list-item-name { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-sub { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }
.list-item-badge { font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 20px; display: inline-block; margin-top: 3px; }

.list-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ============================================
   BADGE
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-purple { background: var(--purple-light); color: var(--purple); }

/* ============================================
   FAB (Floating Action Button)
   ============================================ */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + 20px);
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--primary);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
  transition: all 0.2s;
  z-index: 50;
  font-size: 1.4rem;
  font-family: var(--font);
}

.fab:active { transform: scale(0.92); }

/* ============================================
   INVOICE THEMES
   ============================================ */
.invoice-preview {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.theme-classic .inv-header { background: #1E293B; color: white; }
.theme-modern .inv-header { background: linear-gradient(135deg, #2563EB, #1D4ED8); color: white; }
.theme-elegant .inv-header { background: linear-gradient(135deg, #7C3AED, #6D28D9); color: white; }
.theme-green .inv-header { background: linear-gradient(135deg, #059669, #047857); color: white; }
.theme-warm .inv-header { background: linear-gradient(135deg, #D97706, #B45309); color: white; }

.inv-header {
  padding: 24px 20px;
}

.inv-body {
  padding: 20px;
}

.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin: 12px 0;
}

.inv-table th {
  background: var(--bg);
  padding: 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.inv-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: top;
}

.inv-table tr:last-child td { border-bottom: none; }

.inv-total-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.inv-total-row.grand {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  border-top: 2px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}

.inv-footer {
  background: var(--bg);
  padding: 14px 20px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ============================================
   THEME SELECTOR
   ============================================ */
.theme-selector {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.theme-selector::-webkit-scrollbar { display: none; }

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.theme-swatch {
  width: 54px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.theme-option.active .theme-swatch { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.3); }
.theme-name { font-size: 0.7rem; color: var(--text-secondary); font-weight: 500; }

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1E293B;
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 500;
  opacity: 0;
  transition: all 0.3s;
  white-space: nowrap;
  max-width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* ============================================
   DIVIDER
   ============================================ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ============================================
   CHIPS / FILTER TABS
   ============================================ */
.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar { display: none; }

.chip {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  font-family: var(--font);
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ============================================
   SETTINGS
   ============================================ */
.settings-group {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.settings-group-title {
  padding: 12px 16px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}

.settings-item:last-child { border-bottom: none; }
.settings-item:active { background: var(--bg); }

.settings-item-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.settings-item-info { flex: 1; }
.settings-item-label { font-size: 0.9rem; font-weight: 500; color: var(--text-primary); }
.settings-item-desc { font-size: 0.75rem; color: var(--text-secondary); margin-top: 1px; }

.settings-item-arrow {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ============================================
   LOGO UPLOAD
   ============================================ */
.logo-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
}

.logo-upload:hover { border-color: var(--primary); background: var(--primary-light); }

.logo-preview {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.logo-placeholder {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

/* ============================================
   QUANTITY CONTROL
   ============================================ */
.qty-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qty-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.2s;
  flex-shrink: 0;
}

.qty-btn:active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

.qty-input {
  width: 60px;
  text-align: center;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 4px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-primary);
  outline: none;
}

.qty-input:focus { border-color: var(--primary); }

/* ============================================
   CART ITEM
   ============================================ */
.cart-item {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.cart-item-info { flex: 1; }
.cart-item-name { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.cart-item-price { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }

.cart-item-right { text-align: right; }
.cart-item-total { font-size: 0.95rem; font-weight: 700; color: var(--primary); }

.cart-remove {
  background: var(--danger-light);
  color: var(--danger);
  border: none;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

/* ============================================
   QR CODE
   ============================================ */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.qr-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-align: center;
}

/* ============================================
   SWITCH TOGGLE
   ============================================ */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}

.switch input { display: none; }

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border);
  border-radius: 26px;
  transition: 0.3s;
}

.switch-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

/* ============================================
   INVOICE VIEW (Customer View)
   ============================================ */
.inv-view {
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
}

.inv-view-header {
  background: white;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.inv-actions-bar {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  background: white;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

/* ============================================
   ABOUT PAGE
   ============================================ */
.about-hero {
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  padding: 40px 20px;
  text-align: center;
  color: white;
}

.about-logo {
  width: 80px;
  height: 80px;
  background: white;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

/* ============================================
   RESPONSIVE (Tablet)
   ============================================ */
@media (min-width: 481px) {
  #app, .bottom-nav, .app-header, .page-header {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }

  .toast { max-width: 400px; }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ============================================
   UTILITIES
   ============================================ */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-blue { color: var(--primary); }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.fs-sm { font-size: 0.82rem; }
.fs-xs { font-size: 0.75rem; }

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

.p-16 { padding: 16px; }
.p-20 { padding: 20px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.overflow-hidden { overflow: hidden; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Page transition */
.page-enter { animation: pageIn 0.25s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, #f0f4f8 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* No select for buttons */
button, .nav-item, .quick-action {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* ============================================
   PULL TO REFRESH INDICATOR
   ============================================ */
.ptr-indicator {
  position: fixed;
  top: var(--header-height);
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 6px 16px;
  border-radius: 0 0 12px 12px;
  font-size: 0.78rem;
  z-index: 90;
  display: none;
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   INVOICE NUMBER DISPLAY
   ============================================ */
.inv-number-tag {
  display: inline-flex;
  align-items: center;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* ============================================
   AMOUNT DISPLAY
   ============================================ */
.amount-large {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.amount-currency {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  vertical-align: super;
}

/* ============================================
   CARD HOVER EFFECTS
   ============================================ */
.hoverable {
  transition: transform 0.2s, box-shadow 0.2s;
}

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

/* ============================================
   GRADIENT TEXT
   ============================================ */
.gradient-text {
  background: linear-gradient(135deg, #2563EB, #7C3AED);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================
   INFO ROW
   ============================================ */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.info-row:last-child { border-bottom: none; }

.info-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.info-value {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
  max-width: 60%;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ============================================
   NOTIFICATION DOT
   ============================================ */
.notif-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid white;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  .bottom-nav,
  .app-header,
  .page-header,
  #ownerBar,
  #customerBar,
  .fab,
  .btn,
  button {
    display: none !important;
  }

  body {
    background: white;
  }

  .invoice-preview {
    box-shadow: none;
    border: 1px solid #ccc;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* ============================================
   INVOICE WATERMARK (Cancelled)
   ============================================ */
.inv-cancelled-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 3rem;
  font-weight: 900;
  color: rgba(239,68,68,0.15);
  pointer-events: none;
  z-index: 0;
  white-space: nowrap;
  letter-spacing: 4px;
  text-transform: uppercase;
}

/* ============================================
   FLOATING LABELS
   ============================================ */
.form-group-float {
  position: relative;
  margin-bottom: 16px;
}

.form-input-float {
  width: 100%;
  padding: 20px 16px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--card-bg);
  outline: none;
  transition: all 0.2s;
}

.form-label-float {
  position: absolute;
  left: 16px;
  top: 14px;
  font-size: 0.92rem;
  color: var(--text-muted);
  transition: all 0.2s;
  pointer-events: none;
}

.form-input-float:focus ~ .form-label-float,
.form-input-float:not(:placeholder-shown) ~ .form-label-float {
  top: 6px;
  font-size: 0.7rem;
  color: var(--primary);
}

/* ============================================
   BOTTOM SHEET ANIMATION IMPROVED
   ============================================ */
.modal-overlay {
  animation: none;
}

.modal-overlay.show {
  animation: fadeIn 0.2s ease forwards;
}

/* ============================================
   DARK MODE SUPPORT (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
  /* Uncomment to enable dark mode */
  /*
  :root {
    --bg: #0F172A;
    --card-bg: #1E293B;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --border: #334155;
  }
  */
}

