/* Beer POS - Unified Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --color-primary: #f59e0b;
  --color-primary-light: #fbbf24;
  --color-bg: #f8fafc;
  --color-card: #ffffff;
  --color-border: #f59e0b;
  --color-text: #111827;
  --color-muted: #6b7280;
  --color-info: #2563eb;
  --color-warning: #f97316;
  --color-danger: #dc2626;
  --topbar-height: 56px;
  --bottomnav-height: 64px;
}

* {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  padding-top: var(--topbar-height);
  padding-bottom: var(--bottomnav-height);
  margin: 0;
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: white;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  z-index: 50;
}

.topbar .logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar .logo-icon { font-size: 20px; }
.topbar .logo-text { font-weight: 600; font-size: 16px; }
.topbar .actions { display: flex; gap: 12px; font-size: 18px; }
.topbar .actions a, .topbar .actions button {
  color: var(--color-muted);
  padding: 4px 8px;
  border-radius: 6px;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
}
.topbar .actions a:hover, .topbar .actions button:hover {
  background: var(--color-bg);
}

/* Bottom Navigation */
.bottomnav {
  height: var(--bottomnav-height);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 3px solid var(--color-primary);
  box-shadow: 0 -4px 20px rgba(245,158,11,0.15);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  text-align: center;
  font-size: 11px;
  max-width: 500px;
  margin: 0 auto;
  z-index: 50;
}

.bottomnav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--color-muted);
  text-decoration: none;
  transition: .2s;
}

.bottomnav a .icon { font-size: 20px; }
.bottomnav a.active {
  color: var(--color-primary);
  font-weight: 600;
  transform: translateY(-2px);
}

/* Text contrast: nền sáng → chữ đậm; nền đậm → chữ trắng (contrast ≥ 4.5) */
.text-main { color: #111827; }
.text-muted { color: #6b7280; }

/* Card */
.card {
  background: var(--color-card);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--color-border);
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
  transition: .2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

/* Buttons */
button, .btn {
  transition: transform 0.1s, box-shadow 0.2s;
}

button:active, .btn:active, a:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: white;
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(245,158,11,0.35);
  cursor: pointer;
  width: 100%;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-primary:disabled {
  opacity: 0.5;
  filter: none;
  box-shadow: none;
}

/* Form Elements */
input, select {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.15);
  outline: none;
}

/* Product Card */
.product-card {
  border-radius: 14px;
  padding: 14px;
  background: white;
  border: 1px solid var(--color-bg);
  cursor: pointer;
}

.product-card:active {
  transform: scale(0.96);
  background: #f0fdf4;
}

/* Stat Card */
.stat-card {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: white;
  border-radius: 16px;
  padding: 18px;
}

.stat-card .value { font-size: 28px; font-weight: 700; }
.stat-card .label { font-size: 13px; opacity: 0.9; }

/* Page Animation */
.page-enter {
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* Main Content */
main {
  padding: 16px;
  padding-bottom: 96px;
  max-width: 500px;
  margin: 0 auto;
}

/* Utilities */
.text-primary { color: var(--color-primary); }
.text-muted { color: var(--color-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 30px; }

.bg-white { background: white; }
.bg-gray-50 { background: #f9fafb; }
.bg-gray-100 { background: #f3f4f6; }
.bg-amber-50 { background: #fffbeb; }
.bg-blue-50 { background: #eff6ff; }
.bg-red-50 { background: #fef2f2; }

.rounded { border-radius: 8px; }
.rounded-lg { border-radius: 12px; }
.rounded-xl { border-radius: 16px; }
.rounded-full { border-radius: 9999px; }

.shadow { box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.shadow-md { box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.shadow-lg { box-shadow: 0 10px 15px rgba(0,0,0,0.1); }

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

.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-5 { grid-template-columns: repeat(5, 1fr); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }

.m-0 { margin: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.ml-1 { margin-left: 4px; }
.ml-2 { margin-left: 8px; }
.mr-1 { margin-right: 4px; }
.mr-2 { margin-right: 8px; }

.border { border: 1px solid var(--color-border); }
.border-t { border-top: 1px solid var(--color-border); }
.border-b { border-bottom: 1px solid var(--color-border); }

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

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.z-10 { z-index: 10; }
.z-50 { z-index: 50; }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: #fffbeb; color: #92400e; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-muted);
}

/* List Items */
.list-item {
  display: flex;
  align-items: center;
  padding: 12px;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  margin-bottom: 8px;
}

.list-item:active {
  transform: scale(0.98);
  background: #f9fafb;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: white;
  border-radius: 16px;
  padding: 20px;
  width: 90%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
}

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th, .table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.table th {
  font-weight: 600;
  color: var(--color-muted);
  font-size: 12px;
  text-transform: uppercase;
}

/* Header Bar */
.header-bar {
  background: white;
  border-bottom: 1px solid var(--color-border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

/* Section Title */
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Form Group */
.form-group {
  margin-bottom: 16px;
}

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

/* Radio/Checkbox Card */
.radio-card {
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: .2s;
}

.radio-card:hover {
  border-color: var(--color-primary);
}

.radio-card.selected {
  border-color: var(--color-primary);
  background: #f0fdf4;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--color-bg);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 8px 16px;
  text-align: center;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-muted);
  cursor: pointer;
  transition: .2s;
  background: transparent;
  border: none;
}

.tab.active {
  background: white;
  color: var(--color-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Status Indicator */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.amber { background: #f59e0b; }
.status-dot.green { background: #22c55e; }
.status-dot.yellow { background: #eab308; }
.status-dot.red { background: #ef4444; }
.status-dot.gray { background: #9ca3af; }

/* Mobile optimizations */
@media (max-width: 500px) {
  .bottomnav {
    max-width: 100%;
  }

  main {
    padding: 12px;
  }
}

/* =======================
   GRAB-LIKE EXPENSE UI
   ======================= */

/* Quick Action Buttons - Grab style */
.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
}

.quick-action-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
}

.quick-action-btn:active {
  transform: scale(0.95) translateY(2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.quick-action-btn .icon {
  font-size: 32px;
  margin-bottom: 8px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.quick-action-btn .label {
  font-size: 14px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.quick-action-btn.fuel {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.quick-action-btn.food {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.quick-action-btn.repair {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.quick-action-btn.other {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

/* Quick Add Modal - Bottom Sheet Style */
.quick-add-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.quick-add-sheet {
  background: white;
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 500px;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0));
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
}

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

.quick-add-sheet .handle {
  width: 40px;
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  margin: 0 auto 20px;
}

.quick-add-sheet .amount-input {
  font-size: 36px;
  font-weight: 700;
  text-align: center;
  border: none;
  background: #f9fafb;
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  box-sizing: border-box;
}

.quick-add-sheet .amount-input:focus {
  outline: none;
  background: #f0fdf4;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.quick-add-sheet .quick-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.quick-add-sheet .quick-amount {
  background: #f3f4f6;
  border: none;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-add-sheet .quick-amount:active {
  transform: scale(0.95);
  background: #e5e7eb;
}

.quick-add-sheet .save-btn {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
  border: none;
  padding: 18px;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 700;
  width: 100%;
  margin-top: 20px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
  transition: all 0.2s;
}

.quick-add-sheet .save-btn:active {
  transform: scale(0.98);
}

/* Expense Summary Card - Grab style */
.expense-summary {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.35);
  margin-bottom: 16px;
}

.expense-summary .total-label {
  font-size: 14px;
  opacity: 0.9;
}

.expense-summary .total-amount {
  font-size: 32px;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.expense-summary .breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.2);
}

.expense-summary .breakdown-item {
  text-align: center;
  background: rgba(255,255,255,0.15);
  padding: 10px 8px;
  border-radius: 12px;
}

.expense-summary .breakdown-item .icon {
  font-size: 20px;
}

.expense-summary .breakdown-item .value {
  font-size: 14px;
  font-weight: 700;
}

.expense-summary .breakdown-item .label {
  font-size: 11px;
  opacity: 0.8;
}

/* Floating Action Button - Grab style */
.fab {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: fixed;
  bottom: 90px;
  right: 20px;
  z-index: 40;
}

.fab:active {
  transform: scale(0.9);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.fab.primary {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  font-size: 28px;
}

/* Nav Highlight - Special tab */
.nav-highlight {
  position: relative;
}

.nav-highlight::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 50%;
  transform: translateX(50%);
  width: 6px;
  height: 6px;
  background: #ef4444;
  border-radius: 50%;
}

.nav-highlight.active::after {
  background: #ef4444;
}

/* Smooth animations */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.animate-pulse-slow {
  animation: pulse 2s infinite;
}

/* List item with swipe-like feedback */
.expense-item {
  display: flex;
  align-items: center;
  padding: 16px;
  background: white;
  border-radius: 16px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.2s;
  cursor: pointer;
}

.expense-item:active {
  transform: scale(0.98);
  background: #f9fafb;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.expense-item .icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-right: 14px;
}

.expense-item .icon-wrapper.fuel { background: #fff7ed; }
.expense-item .icon-wrapper.food { background: #f0fdf4; }
.expense-item .icon-wrapper.repair { background: #eff6ff; }
.expense-item .icon-wrapper.other { background: #f3f4f6; }

.expense-item .content {
  flex: 1;
}

.expense-item .title {
  font-weight: 600;
  font-size: 15px;
}

.expense-item .subtitle {
  font-size: 13px;
  color: #6b7280;
}

.expense-item .amount {
  font-weight: 700;
  font-size: 16px;
  color: #ef4444;
}

/* =============================================
   DARK MODE — activated via data-theme="dark"
   ============================================= */
[data-theme="dark"] {
  --color-bg: #0f172a;
  --color-card: #1e293b;
  --color-border: #334155;
  --color-text: #f1f5f9;
  --color-muted: #94a3b8;

  /* Keep primary amber for brand consistency */
  /* Topbar & bottom nav */
  --topbar-bg: #1e293b;
  --bottomnav-bg: #1e293b;
}

[data-theme="dark"] body {
  background: var(--color-bg);
  color: var(--color-text);
}

/* ── Tailwind utility colors: background ── */
[data-theme="dark"] .bg-white { background: #1e293b !important; }
[data-theme="dark"] .bg-gray-50 { background: #1e293b !important; }
[data-theme="dark"] .bg-gray-100 { background: #334155 !important; }
[data-theme="dark"] .bg-gray-200 { background: #334155 !important; }
[data-theme="dark"] .bg-gray-300 { background: #475569 !important; }
[data-theme="dark"] .bg-gray-500 { background: #475569 !important; }
[data-theme="dark"] .bg-amber-50 { background: rgba(251,191,36,0.1) !important; }
[data-theme="dark"] .bg-amber-100 { background: rgba(251,191,36,0.2) !important; }
[data-theme="dark"] .bg-amber-400 { background: rgba(251,191,36,0.8) !important; }
[data-theme="dark"] .bg-amber-500 { background: rgba(251,191,36,0.9) !important; }
[data-theme="dark"] .bg-amber-600 { background: var(--color-primary) !important; }
[data-theme="dark"] .bg-blue-50 { background: rgba(59,130,246,0.1) !important; }
[data-theme="dark"] .bg-blue-100 { background: rgba(59,130,246,0.2) !important; }
[data-theme="dark"] .bg-blue-500 { background: rgba(59,130,246,0.9) !important; }
[data-theme="dark"] .bg-blue-600 { background: rgba(59,130,246,0.9) !important; }
[data-theme="dark"] .bg-emerald-50 { background: rgba(34,197,94,0.1) !important; }
[data-theme="dark"] .bg-emerald-100 { background: rgba(34,197,94,0.2) !important; }
[data-theme="dark"] .bg-emerald-600 { background: rgba(34,197,94,0.9) !important; }
[data-theme="dark"] .bg-green-50 { background: rgba(34,197,94,0.1) !important; }
[data-theme="dark"] .bg-green-100 { background: rgba(34,197,94,0.2) !important; }
[data-theme="dark"] .bg-green-500 { background: rgba(34,197,94,0.9) !important; }
[data-theme="dark"] .bg-green-600 { background: rgba(34,197,94,0.9) !important; }
[data-theme="dark"] .bg-indigo-50 { background: rgba(99,102,241,0.1) !important; }
[data-theme="dark"] .bg-indigo-100 { background: rgba(99,102,241,0.2) !important; }
[data-theme="dark"] .bg-indigo-500 { background: rgba(99,102,241,0.9) !important; }
[data-theme="dark"] .bg-orange-50 { background: rgba(249,115,22,0.1) !important; }
[data-theme="dark"] .bg-orange-100 { background: rgba(249,115,22,0.2) !important; }
[data-theme="dark"] .bg-orange-500 { background: rgba(249,115,22,0.9) !important; }
[data-theme="dark"] .bg-orange-600 { background: rgba(249,115,22,0.9) !important; }
[data-theme="dark"] .bg-purple-50 { background: rgba(168,85,247,0.1) !important; }
[data-theme="dark"] .bg-purple-100 { background: rgba(168,85,247,0.2) !important; }
[data-theme="dark"] .bg-purple-500 { background: rgba(168,85,247,0.9) !important; }
[data-theme="dark"] .bg-purple-600 { background: rgba(168,85,247,0.9) !important; }
[data-theme="dark"] .bg-red-50 { background: rgba(239,68,68,0.1) !important; }
[data-theme="dark"] .bg-red-100 { background: rgba(239,68,68,0.2) !important; }
[data-theme="dark"] .bg-red-500 { background: rgba(239,68,68,0.9) !important; }
[data-theme="dark"] .bg-red-600 { background: rgba(220,38,38,0.9) !important; }
[data-theme="dark"] .bg-yellow-50 { background: rgba(234,179,8,0.1) !important; }
[data-theme="dark"] .bg-yellow-100 { background: rgba(234,179,8,0.2) !important; }

/* ── Tailwind utility colors: text ── */
[data-theme="dark"] .text-gray-300 { color: #cbd5e1 !important; }
[data-theme="dark"] .text-gray-400 { color: #94a3b8 !important; }
[data-theme="dark"] .text-gray-500 { color: #94a3b8 !important; }
[data-theme="dark"] .text-gray-600 { color: #94a3b8 !important; }
[data-theme="dark"] .text-gray-700 { color: #cbd5e1 !important; }
[data-theme="dark"] .text-gray-800 { color: #f1f5f9 !important; }
[data-theme="dark"] .text-white { color: #f8fafc !important; }
[data-theme="dark"] .text-amber-100 { color: rgba(251,191,36,0.8) !important; }
[data-theme="dark"] .text-amber-500 { color: #fbbf24 !important; }
[data-theme="dark"] .text-amber-600 { color: #fbbf24 !important; }
[data-theme="dark"] .text-amber-700 { color: #f59e0b !important; }
[data-theme="dark"] .text-amber-800 { color: #f59e0b !important; }
[data-theme="dark"] .text-blue-500 { color: #60a5fa !important; }
[data-theme="dark"] .text-blue-600 { color: #60a5fa !important; }
[data-theme="dark"] .text-blue-700 { color: #3b82f6 !important; }
[data-theme="dark"] .text-emerald-600 { color: #4ade80 !important; }
[data-theme="dark"] .text-emerald-700 { color: #22c55e !important; }
[data-theme="dark"] .text-green-500 { color: #4ade80 !important; }
[data-theme="dark"] .text-green-600 { color: #4ade80 !important; }
[data-theme="dark"] .text-green-700 { color: #22c55e !important; }
[data-theme="dark"] .text-indigo-600 { color: #818cf8 !important; }
[data-theme="dark"] .text-indigo-700 { color: #6366f1 !important; }
[data-theme="dark"] .text-indigo-800 { color: #4f46e5 !important; }
[data-theme="dark"] .text-orange-500 { color: #fb923c !important; }
[data-theme="dark"] .text-orange-600 { color: #fb923c !important; }
[data-theme="dark"] .text-orange-700 { color: #f97316 !important; }
[data-theme="dark"] .text-orange-900 { color: #f97316 !important; }
[data-theme="dark"] .text-purple-500 { color: #c084fc !important; }
[data-theme="dark"] .text-purple-600 { color: #c084fc !important; }
[data-theme="dark"] .text-purple-700 { color: #a855f7 !important; }
[data-theme="dark"] .text-red-400 { color: #f87171 !important; }
[data-theme="dark"] .text-red-500 { color: #f87171 !important; }
[data-theme="dark"] .text-red-600 { color: #ef4444 !important; }
[data-theme="dark"] .text-red-700 { color: #dc2626 !important; }
[data-theme="dark"] .text-yellow-600 { color: #facc15 !important; }
[data-theme="dark"] .text-yellow-700 { color: #eab308 !important; }
[data-theme="dark"] .text-yellow-900 { color: #ca8a04 !important; }

/* ── Tailwind utility colors: border ── */
[data-theme="dark"] .border-gray-100 { border-color: #334155 !important; }
[data-theme="dark"] .border-gray-200 { border-color: #334155 !important; }
[data-theme="dark"] .border-gray-300 { border-color: #475569 !important; }
[data-theme="dark"] .border-amber-100 { border-color: rgba(251,191,36,0.3) !important; }
[data-theme="dark"] .border-amber-200 { border-color: rgba(251,191,36,0.4) !important; }
[data-theme="dark"] .border-blue-100 { border-color: rgba(59,130,246,0.3) !important; }
[data-theme="dark"] .border-blue-200 { border-color: rgba(59,130,246,0.4) !important; }
[data-theme="dark"] .border-blue-300 { border-color: rgba(59,130,246,0.5) !important; }
[data-theme="dark"] .border-blue-600 { border-color: rgba(59,130,246,0.9) !important; }
[data-theme="dark"] .border-emerald-200 { border-color: rgba(34,197,94,0.4) !important; }
[data-theme="dark"] .border-green-100 { border-color: rgba(34,197,94,0.3) !important; }
[data-theme="dark"] .border-green-200 { border-color: rgba(34,197,94,0.4) !important; }
[data-theme="dark"] .border-green-600 { border-color: rgba(34,197,94,0.9) !important; }
[data-theme="dark"] .border-indigo-200 { border-color: rgba(99,102,241,0.4) !important; }
[data-theme="dark"] .border-indigo-300 { border-color: rgba(99,102,241,0.5) !important; }
[data-theme="dark"] .border-orange-100 { border-color: rgba(249,115,22,0.3) !important; }
[data-theme="dark"] .border-orange-200 { border-color: rgba(249,115,22,0.4) !important; }
[data-theme="dark"] .border-orange-300 { border-color: rgba(249,115,22,0.5) !important; }
[data-theme="dark"] .border-purple-200 { border-color: rgba(168,85,247,0.4) !important; }
[data-theme="dark"] .border-red-100 { border-color: rgba(239,68,68,0.3) !important; }
[data-theme="dark"] .border-red-200 { border-color: rgba(239,68,68,0.4) !important; }
[data-theme="dark"] .border-red-300 { border-color: rgba(239,68,68,0.5) !important; }
[data-theme="dark"] .border-white { border-color: #334155 !important; }
[data-theme="dark"] .border-yellow-200 { border-color: rgba(234,179,8,0.4) !important; }

/* ── Tailwind utility colors: gradient ── */
[data-theme="dark"] .from-blue-500 { --tw-gradient-from: #60a5fa; }
[data-theme="dark"] .from-blue-600 { --tw-gradient-from: #60a5fa; }
[data-theme="dark"] .from-red-500 { --tw-gradient-from: #f87171; }
[data-theme="dark"] .from-red-600 { --tw-gradient-from: #ef4444; }
[data-theme="dark"] .to-blue-500 { --tw-gradient-to: #60a5fa; }
[data-theme="dark"] .to-blue-600 { --tw-gradient-to: #60a5fa; }
[data-theme="dark"] .to-red-600 { --tw-gradient-to: #ef4444; }

/* ── Tailwind: hover states (background) ── */
[data-theme="dark"] .hover\:bg-gray-50:hover { background: rgba(255,255,255,0.05) !important; }
[data-theme="dark"] .hover\:bg-gray-100:hover { background: rgba(255,255,255,0.08) !important; }
[data-theme="dark"] .hover\:bg-gray-200:hover { background: rgba(255,255,255,0.12) !important; }
[data-theme="dark"] .hover\:bg-gray-300:hover { background: rgba(255,255,255,0.15) !important; }
[data-theme="dark"] .hover\:bg-gray-400:hover { background: rgba(255,255,255,0.2) !important; }
[data-theme="dark"] .hover\:bg-amber-50:hover { background: rgba(251,191,36,0.15) !important; }
[data-theme="dark"] .hover\:bg-amber-100:hover { background: rgba(251,191,36,0.2) !important; }
[data-theme="dark"] .hover\:bg-amber-200:hover { background: rgba(251,191,36,0.25) !important; }
[data-theme="dark"] .hover\:bg-amber-500:hover { background: #f59e0b !important; }
[data-theme="dark"] .hover\:bg-amber-700:hover { background: #d97706 !important; }
[data-theme="dark"] .hover\:bg-blue-50:hover { background: rgba(59,130,246,0.15) !important; }
[data-theme="dark"] .hover\:bg-blue-100:hover { background: rgba(59,130,246,0.2) !important; }
[data-theme="dark"] .hover\:bg-blue-600:hover { background: #2563eb !important; }
[data-theme="dark"] .hover\:bg-blue-700:hover { background: #1d4ed8 !important; }
[data-theme="dark"] .hover\:bg-green-100:hover { background: rgba(34,197,94,0.2) !important; }
[data-theme="dark"] .hover\:bg-green-700:hover { background: #16a34a !important; }
[data-theme="dark"] .hover\:bg-orange-100:hover { background: rgba(249,115,22,0.2) !important; }
[data-theme="dark"] .hover\:bg-orange-600:hover { background: #ea580c !important; }
[data-theme="dark"] .hover\:bg-purple-600:hover { background: #9333ea !important; }
[data-theme="dark"] .hover\:bg-red-50:hover { background: rgba(239,68,68,0.15) !important; }
[data-theme="dark"] .hover\:bg-red-100:hover { background: rgba(239,68,68,0.2) !important; }
[data-theme="dark"] .hover\:bg-red-700:hover { background: #b91c1c !important; }

/* ── Tailwind: hover states (text) ── */
[data-theme="dark"] .hover\:text-blue-600:hover { color: #60a5fa !important; }
[data-theme="dark"] .hover\:text-blue-700:hover { color: #60a5fa !important; }
[data-theme="dark"] .hover\:text-blue-800:hover { color: #3b82f6 !important; }
[data-theme="dark"] .hover\:text-gray-600:hover { color: #cbd5e1 !important; }
[data-theme="dark"] .hover\:text-gray-700:hover { color: #e2e8f0 !important; }
[data-theme="dark"] .hover\:text-green-600:hover { color: #4ade80 !important; }
[data-theme="dark"] .hover\:text-orange-800:hover { color: #f97316 !important; }
[data-theme="dark"] .hover\:text-red-600:hover { color: #f87171 !important; }

/* ── Inline style colors used in HTML ── */
[data-theme="dark"] [style*="background:#f9fafb"] { background: #1e293b !important; }
[data-theme="dark"] [style*="background:#f0fdf4"] { background: rgba(34,197,94,0.1) !important; }
[data-theme="dark"] [style*="background:#fef3c7"] { background: rgba(251,191,36,0.1) !important; }
[data-theme="dark"] [style*="background:#fee2e2"] { background: rgba(239,68,68,0.1) !important; }
[data-theme="dark"] [style*="background:#dbeafe"] { background: rgba(59,130,246,0.1) !important; }
[data-theme="dark"] [style*="background:#ede9fe"] { background: rgba(168,85,247,0.1) !important; }
[data-theme="dark"] [style*="background:#fce7f3"] { background: rgba(236,72,153,0.1) !important; }
[data-theme="dark"] [style*="background:#fff7ed"] { background: rgba(249,115,22,0.1) !important; }
[data-theme="dark"] [style*="background:#f0f9ff"] { background: rgba(14,165,233,0.1) !important; }
[data-theme="dark"] [style*="background:#f9fafb"] { background: #1e293b !important; }

/* ── Additional semantic dark-mode overrides ── */
[data-theme="dark"] .bg-gradient-to-r { background-image: linear-gradient(to right, rgba(251,191,36,0.3), rgba(251,191,36,0.15)) !important; }
[data-theme="dark"] .text-opacity-90 { --tw-text-opacity: 0.9; }
[data-theme="dark"] .shadow-sm { --tw-shadow-color: rgba(0,0,0,0.3); }
[data-theme="dark"] .shadow-md { --tw-shadow-color: rgba(0,0,0,0.3); }
[data-theme="dark"] .shadow-lg { --tw-shadow-color: rgba(0,0,0,0.4); }
[data-theme="dark"] .shadow-xl { --tw-shadow-color: rgba(0,0,0,0.5); }

/* ── Invoice & modal content (used in sales.html inline styles) ── */
[data-theme="dark"] .invoice-pos-content .invoice-item { border-bottom-color: #334155; }
[data-theme="dark"] .invoice-pos-content .invoice-item .invoice-name { color: #f1f5f9; }
[data-theme="dark"] .invoice-pos-content .invoice-item .invoice-row { color: #94a3b8; }
[data-theme="dark"] .invoice-pos-content .invoice-item .invoice-total { color: #f1f5f9; }

/* ── Spinner border ── */
[data-theme="dark"] .border-blue-600 { border-color: #60a5fa !important; }
[data-theme="dark"] .border-t-transparent { border-top-color: transparent !important; }

/* ── Additional text color overrides for template-generated content ── */
[data-theme="dark"] .text-slate-500 { color: #94a3b8 !important; }
[data-theme="dark"] .text-slate-600 { color: #94a3b8 !important; }
[data-theme="dark"] .text-slate-700 { color: #cbd5e1 !important; }
[data-theme="dark"] .text-slate-800 { color: #f1f5f9 !important; }

/* ── Dark mode active states for bg elements ── */
[data-theme="dark"] .active\:bg-blue-600:active,
[data-theme="dark"] [class*="active bg-blue-600"] { background-color: #2563eb !important; }

[data-theme="dark"] input::placeholder { color: #64748b !important; }

[data-theme="dark"] .ring-blue-500 { --tw-ring-color: #60a5fa !important; }

[data-theme="dark"] .divide-gray-100 > * + * { border-color: #334155 !important; }
[data-theme="dark"] .divide-gray-200 > * + * { border-color: #334155 !important; }

[data-theme="dark"] .topbar {
  background: var(--topbar-bg);
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .topbar .logo-text {
  color: #f1f5f9;
}

[data-theme="dark"] .topbar .actions a,
[data-theme="dark"] .topbar .actions button {
  color: #94a3b8;
}

[data-theme="dark"] .topbar .actions a:hover,
[data-theme="dark"] .topbar .actions button:hover {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .bottomnav {
  background: var(--bottomnav-bg);
  border-top-color: var(--color-border);
}

[data-theme="dark"] .bottomnav a {
  color: #94a3b8;
}

[data-theme="dark"] .bottomnav a.active {
  color: #fbbf24;
}

[data-theme="dark"] .text-main {
  color: #f1f5f9;
}

[data-theme="dark"] .text-muted {
  color: #94a3b8;
}

[data-theme="dark"] .card {
  background: var(--color-card);
  border-color: var(--color-border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .card:hover {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] input,
[data-theme="dark"] select {
  background: #1e293b;
  border-color: var(--color-border);
  color: #f1f5f9;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus {
  border-color: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}

[data-theme="dark"] .product-card {
  background: #1e293b;
  border-color: var(--color-border);
}

[data-theme="dark"] .product-card:active {
  background: #1e293b;
  border-color: #fbbf24;
}

[data-theme="dark"] .badge-success {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

[data-theme="dark"] .badge-warning {
  background: rgba(251, 146, 60, 0.15);
  color: #fb923c;
}

[data-theme="dark"] .badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

[data-theme="dark"] .badge-info {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .modal {
  background: #1e293b;
}

[data-theme="dark"] .quick-add-sheet {
  background: #1e293b;
}

[data-theme="dark"] .quick-add-sheet .amount-input {
  background: #0f172a;
  color: #f1f5f9;
}

[data-theme="dark"] .quick-add-sheet .handle {
  background: #334155;
}

[data-theme="dark"] .quick-add-sheet .quick-amount {
  background: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .quick-add-sheet .quick-amount:active {
  background: #475569;
}

[data-theme="dark"] .list-item {
  background: #1e293b;
  border-color: var(--color-border);
}

[data-theme="dark"] .list-item:active {
  background: #334155;
}

[data-theme="dark"] .table th,
[data-theme="dark"] .table td {
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .table th {
  color: #94a3b8;
}

[data-theme="dark"] .header-bar {
  background: #1e293b;
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .tab {
  color: #94a3b8;
}

[data-theme="dark"] .tab.active {
  background: #334155;
  color: #fbbf24;
}

[data-theme="dark"] .tabs {
  background: #1e293b;
}

[data-theme="dark"] .expense-item {
  background: #1e293b;
  border-color: var(--color-border);
}

[data-theme="dark"] .expense-item:active {
  background: #334155;
}

[data-theme="dark"] .expense-item .icon-wrapper.fuel {
  background: rgba(249, 115, 22, 0.15);
}

[data-theme="dark"] .expense-item .icon-wrapper.food {
  background: rgba(34, 197, 94, 0.15);
}

[data-theme="dark"] .expense-item .icon-wrapper.repair {
  background: rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .expense-item .icon-wrapper.other {
  background: rgba(148, 163, 184, 0.15);
}

[data-theme="dark"] .expense-item .subtitle {
  color: #94a3b8;
}

[data-theme="dark"] .spinner {
  border-color: #334155;
  border-top-color: #fbbf24;
}

/* Dark mode status dots */
[data-theme="dark"] .status-dot.amber { background: #fbbf24; }
[data-theme="dark"] .status-dot.yellow { background: #facc15; }
[data-theme="dark"] .status-dot.green { background: #4ade80; }
[data-theme="dark"] .status-dot.red { background: #f87171; }
[data-theme="dark"] .status-dot.gray { background: #64748b; }

/* Dark mode bg utilities (already defined above, kept for compatibility) */

/* Dark mode skeleton loaders */
[data-theme="dark"] .animate-pulse > div {
  background: #334155 !important;
}

/* Dark mode chart backgrounds (if charts are present) */
[data-theme="dark"] canvas {
  filter: brightness(0.9);
}

/* Smooth transition when switching themes */
body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] body {
  transition: background-color 0.3s ease, color 0.3s ease;
}
