* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
  transition: background-color .2s ease, color .2s ease;
}
code, pre, .font-mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
}

/* ══════════════════════════════════════
   DARK THEME STYLES (ENTERPRISE HIGH CONTRAST)
   ══════════════════════════════════════ */
html.dark body {
  background-color: #0b0f19 !important;
  color: #f8fafc !important;
}
html.dark #loginScreen {
  background-color: #0b0f19 !important;
}

/* Prevent flash of login screen on page/tab navigation when already authenticated */
html.is-authenticated #loginScreen {
  display: none !important;
}
html.is-authenticated #appRoot {
  display: block !important;
}
html.not-authenticated #loginScreen {
  display: flex !important;
}
html.not-authenticated #appRoot {
  display: none !important;
}

html.dark .bg-white {
  background-color: #131b2e !important;
  color: #f8fafc !important;
}
html.dark .bg-slate-50 {
  background-color: #0e1626 !important;
  color: #cbd5e1 !important;
}
html.dark .bg-slate-100 {
  background-color: #1a2336 !important;
  color: #f1f5f9 !important;
}

/* VCATCH logo subtle dark-mode contrast */
html.dark .header-logo-img {
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 4px rgba(255, 255, 255, 0.3));
}

/* High-contrast crisp typography in Dark Mode */
html.dark .text-slate-900 {
  color: #ffffff !important;
  font-weight: 700;
}
html.dark .text-slate-800 {
  color: #f8fafc !important;
}
html.dark .text-slate-700 {
  color: #e2e8f0 !important;
}
html.dark .text-slate-600 {
  color: #cbd5e1 !important;
}
html.dark .text-slate-500 {
  color: #94a3b8 !important;
  font-weight: 600;
}
html.dark .text-slate-400 {
  color: #94a3b8 !important;
}
html.dark .text-slate-300 {
  color: #cbd5e1 !important;
}

/* Vibrant status & accent typography in Dark Mode */
html.dark .text-orange-600, html.dark .text-orange-700 {
  color: #fb923c !important;
}
html.dark .text-blue-600, html.dark .text-blue-700 {
  color: #60a5fa !important;
}
html.dark .text-emerald-600, html.dark .text-emerald-700 {
  color: #34d399 !important;
}
html.dark .text-amber-600, html.dark .text-amber-700 {
  color: #fbbf24 !important;
}
html.dark .text-rose-600, html.dark .text-rose-700 {
  color: #fb7185 !important;
}
html.dark .text-purple-600, html.dark .text-purple-700 {
  color: #c084fc !important;
}

/* Sleek dark tinted cards (replaces blinding white/pastel boxes) */
html.dark .bg-emerald-50 {
  background-color: rgba(16, 185, 129, 0.14) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}
html.dark .bg-rose-50 {
  background-color: rgba(244, 63, 94, 0.14) !important;
  border-color: rgba(244, 63, 94, 0.3) !important;
}
html.dark .bg-orange-50 {
  background-color: rgba(234, 88, 12, 0.16) !important;
  border-color: rgba(234, 88, 12, 0.35) !important;
}
html.dark .bg-amber-50 {
  background-color: rgba(245, 158, 11, 0.14) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}
html.dark .bg-blue-50 {
  background-color: rgba(59, 130, 246, 0.14) !important;
  border-color: rgba(59, 130, 246, 0.3) !important;
}
html.dark .bg-purple-50 {
  background-color: rgba(168, 85, 247, 0.14) !important;
  border-color: rgba(168, 85, 247, 0.3) !important;
}

html.dark .hover\:bg-orange-50:hover {
  background-color: rgba(234, 88, 12, 0.22) !important;
}
html.dark .hover\:bg-orange-100:hover {
  background-color: rgba(234, 88, 12, 0.3) !important;
}
html.dark .hover\:bg-emerald-50:hover, html.dark .hover\:bg-emerald-100:hover {
  background-color: rgba(16, 185, 129, 0.22) !important;
}
html.dark .hover\:bg-blue-50:hover {
  background-color: rgba(59, 130, 246, 0.22) !important;
}
html.dark .hover\:bg-rose-50:hover {
  background-color: rgba(244, 63, 94, 0.22) !important;
}

html.dark .border-emerald-200 { border-color: rgba(16, 185, 129, 0.3) !important; }
html.dark .border-rose-200 { border-color: rgba(244, 63, 94, 0.3) !important; }
html.dark .border-orange-200 { border-color: rgba(234, 88, 12, 0.35) !important; }
html.dark .border-amber-200 { border-color: rgba(245, 158, 11, 0.3) !important; }

/* Dark Mode Borders */
html.dark .border-slate-100,
html.dark .border-slate-200,
html.dark .border-slate-300 {
  border-color: #1e293b !important;
}

/* Inputs, dropdowns and textareas */
html.dark input, 
html.dark select, 
html.dark textarea {
  background-color: #090e17 !important;
  color: #f8fafc !important;
  border-color: #27354f !important;
}
html.dark input::placeholder,
html.dark textarea::placeholder {
  color: #64748b !important;
}

/* Header & Navigation Tabs */
html.dark header {
  background-color: rgba(15, 23, 42, 0.96) !important;
  border-color: #1e293b !important;
}
html.dark #mobileBottomNav {
  background-color: rgba(11, 15, 25, 0.96) !important;
  border-color: #1e293b !important;
}
html.dark .nav-tab:not(.active) {
  color: #cbd5e1 !important;
  font-weight: 600 !important;
}
html.dark .nav-tab:not(.active):hover {
  background-color: #1c273e !important;
  color: #ffffff !important;
}

/* Table, Rows, Modals */
html.dark .inv-table th {
  background-color: #131b2e !important;
  color: #94a3b8 !important;
  border-color: #1e293b !important;
  font-weight: 700 !important;
}
html.dark .inv-row:hover {
  background-color: rgba(30, 41, 59, 0.5) !important;
}
html.dark .inv-row.selected {
  background-color: rgba(234, 88, 12, 0.12) !important;
}
html.dark #printSuggestionsDropdown {
  background-color: #131b2e !important;
  border-color: #27354f !important;
  color: #f8fafc !important;
}
html.dark #assetModal > div,
html.dark #addModal > div,
html.dark #assignModal > div,
html.dark #maintModal > div {
  background-color: #131b2e !important;
  border-color: #1e293b !important;
  color: #f8fafc !important;
}
html.dark #themeToggleBtn,
html.dark #loginThemeToggleBtn {
  background-color: #1a2336 !important;
  border-color: #27354f !important;
  color: #f8fafc !important;
}

/* Status chips in Dark Mode */
html.dark .chip-Allocated {
  background: rgba(59, 130, 246, 0.18) !important;
  color: #93c5fd !important;
  border-color: rgba(59, 130, 246, 0.35) !important;
  font-weight: 700 !important;
}
html.dark .chip-Available {
  background: rgba(16, 185, 129, 0.18) !important;
  color: #6ee7b7 !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
  font-weight: 700 !important;
}
html.dark .chip-Maintenance {
  background: rgba(245, 158, 11, 0.18) !important;
  color: #fcd34d !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
  font-weight: 700 !important;
}
html.dark .chip-Scrapped {
  background: rgba(239, 68, 68, 0.18) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  font-weight: 700 !important;
}

html.dark ::-webkit-scrollbar-track {
  background: #0b0f19;
}
html.dark ::-webkit-scrollbar-thumb {
  background: #334155;
}
.pb-safe{padding-bottom:max(env(safe-area-inset-bottom),12px)}
::-webkit-scrollbar{width:5px;height:5px}
::-webkit-scrollbar-track{background:#f8fafc}
::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:4px}
.nav-tab{transition:all .15s ease}
.nav-tab.active{background:#ea580c;color:#fff;box-shadow:0 1px 2px rgba(0,0,0,0.05)}
.tab-content{display:none}
.tab-content.active{display:block}
.inv-row:hover{background:#f8fafc}
.inv-row.selected{background:#fff7ed}
.inv-table th{position:sticky;top:0;background:#f8fafc;color:#475569;border-bottom:1px solid #e2e8f0;z-index:2}
.chip-Allocated{background:#eff6ff;color:#1d4ed8;border:1px solid #bfdbfe}
.chip-Available{background:#f0fdf4;color:#15803d;border:1px solid #bbf7d0}
.chip-Maintenance{background:#fffbeb;color:#b45309;border:1px solid #fde68a}
.chip-Scrapped{background:#fef2f2;color:#b91c1c;border:1px solid #fecaca}
.timeline-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0;margin-top:3px}
.tl-CREATED{background:#22c55e}.tl-CHECKOUT{background:#3b82f6}
.tl-CHECKIN{background:#f59e0b}.tl-MAINTENANCE{background:#ea580c}
.tl-EDITED{background:#a855f7}.tl-SCRAPPED{background:#ef4444}
.tl-STATUS_CHANGE{background:#64748b}
@keyframes slideUp{from{opacity:0;transform:translateY(18px)}to{opacity:1;transform:translateY(0)}}
.slide-up{animation:slideUp .22s ease forwards}
@keyframes spin{to{transform:rotate(360deg)}}
.spin{animation:spin 1s linear infinite}
@keyframes laserSweep {
  0% { top: 6%; opacity: 0.75; }
  50% { top: 88%; opacity: 1; }
  100% { top: 6%; opacity: 0.75; }
}
.scanner-laser {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #ea580c 20%, #f97316 50%, #ea580c 80%, transparent 100%);
  box-shadow: 0 0 8px #ea580c;
  animation: laserSweep 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Scanner Viewport & Video Responsive Styles (Samsung & Mobile WebKit) */
#reader {
  width: 100% !important;
  min-height: 280px !important;
  position: relative !important;
  background: #000 !important;
  border-radius: 1rem !important;
  overflow: hidden !important;
  border: none !important;
}
#reader video {
  width: 100% !important;
  height: 100% !important;
  min-height: 280px !important;
  max-height: 380px !important;
  object-fit: cover !important;
  border-radius: 1rem !important;
  display: block !important;
}
#reader canvas {
  display: none !important;
}
#reader img {
  object-fit: contain !important;
  max-height: 340px !important;
  margin: 0 auto !important;
}
/* ── Exact 50mm × 25mm (Width: 50mm, Height: 25mm) Thermal Sticker ── */
.sticker-label {
  width: 50mm;
  height: 25mm;
  max-width: 50mm;
  max-height: 25mm;
  background: #fff;
  color: #000;
  border: 1px dashed #94a3b8;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  padding: 1.2mm;
  box-sizing: border-box;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
.sticker-qr-zone {
  width: 21mm;
  height: 22.6mm;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #fff;
}
.sticker-qr-zone canvas, .sticker-qr-zone img {
  width: 20.5mm !important;
  height: 20.5mm !important;
  display: block;
  image-rendering: pixelated;
}
.sticker-info-zone {
  flex: 1;
  height: 22.6mm;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-left: 1.8mm;
  overflow: hidden;
  border-left: 1.6px solid #000;
}
.sticker-company {
  font-size: 7pt;
  font-weight: 900;
  letter-spacing: 0.4px;
  color: #000;
  text-transform: uppercase;
  line-height: 1;
  border-bottom: 1.4px solid #000;
  padding-bottom: 0.8mm;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.sticker-company img {
  height: 4.5mm;
  max-height: 18px;
  object-fit: contain;
  display: block;
  filter: contrast(150%) brightness(0);
}
.sticker-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  padding: 0.8mm 0;
  min-height: 0;
}
.sticker-tag {
  font-size: 9.2pt;
  font-weight: 900;
  color: #000;
  font-family: 'JetBrains Mono', 'Courier New', Courier, monospace;
  letter-spacing: 0.2px;
  line-height: 1.2;
  word-break: break-all;
}
.sticker-sn {
  font-size: 6.8pt;
  font-weight: 800;
  color: #000;
  font-family: 'JetBrains Mono', 'Courier New', Courier, monospace;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sticker-model {
  font-size: 6.5pt;
  font-weight: 800;
  color: #000;
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sticker-footer {
  font-size: 6pt;
  font-weight: 900;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  line-height: 1;
  border-top: 1.4px solid #000;
  padding-top: 0.8mm;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

@media print {
  @page {
    size: 50mm 25mm;
    margin: 0 !important;
  }
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    width: 50mm !important;
    height: 25mm !important;
    max-height: 25mm !important;
    overflow: hidden !important;
  }
  #appRoot, #loginScreen, #mobileBottomNav, header, #toast, .no-print {
    display: none !important;
  }
  #printOutputArea {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 50mm !important;
    height: 25mm !important;
    max-height: 25mm !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    visibility: visible !important;
    overflow: hidden !important;
  }
  #printOutputArea * {
    visibility: visible !important;
  }
  .sticker-label {
    width: 50mm !important;
    height: 25mm !important;
    min-width: 50mm !important;
    max-width: 50mm !important;
    min-height: 25mm !important;
    max-height: 25mm !important;
    box-sizing: border-box !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
    page-break-before: avoid !important;
    break-before: avoid !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 1mm 1.2mm !important;
    background: #ffffff !important;
    color: #000000 !important;
    display: flex !important;
    flex-direction: row !important;
    overflow: hidden !important;
  }
  .sticker-qr-zone {
    width: 21mm !important;
    height: 23mm !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
  }
  .sticker-qr-zone canvas, .sticker-qr-zone img {
    width: 20mm !important;
    height: 20mm !important;
    display: block !important;
    image-rendering: pixelated !important;
  }
}
