:root {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --brand: #4f46e5;
  --brand-hover: #4338ca;
}

html.dark {
  --bg-page: #0b1120;
  --bg-card: #111827;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: #1f2937;
}

body {
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* Smooth custom scrollbars */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.45); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.7); }

/* Splash screen fade */
#app-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #4f46e5 0%, #1e1b4b 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
#app-splash.hidden-splash {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Card & modal transitions */
@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.animate-slide-up { animation: slideUpFade 0.22s ease-out both; }

/* Mobile touch-friendly controls */
@media (max-width: 767px) {
  .touch-target { min-height: 44px; }
  main.app-main { padding-bottom: 5.5rem; }
}

/* Safe area for notched phones */
.pb-safe { padding-bottom: max(0.5rem, env(safe-area-inset-bottom)); }

/* Table responsiveness */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  white-space: nowrap;
}
.data-table td { vertical-align: middle; }

/* Print Modes: A4 & Thermal 80mm */
@media print {
  .no-print { display: none !important; }
  body { background: #ffffff !important; color: #000000 !important; margin: 0 !important; padding: 0 !important; }
  .print-sheet { box-shadow: none !important; border: none !important; margin: 0 !important; }
  body.thermal-mode .print-sheet { width: 76mm !important; max-width: 76mm !important; padding: 3mm !important; font-size: 11px !important; }
  body.a4-mode .print-sheet { width: 100% !important; max-width: 210mm !important; padding: 10mm !important; }
}
