/* =========================================================
   Font Setup: Calibri (Luxury Humanist Sans-Serif)
   ========================================================= */
@font-face {
  font-family: 'Calibri';
  src: local('Calibri Light'),
       url('/fonts/calibril.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Calibri';
  src: local('Calibri'),
       url('/fonts/Calibri.ttf') format('truetype');
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Calibri';
  src: local('Calibri Bold'),
       url('/fonts/Calibrib.ttf') format('truetype');
  font-weight: 700 800;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* =========================================================
   SPLASH SCREEN OPENING
   Background putih bersih sesuai latar gambar Yamaha Genuine
   ========================================================= */
.splash-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 99999;
  background-color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.55s ease, visibility 0.55s ease;
  opacity: 1;
  visibility: visible;
  /* Safe area for iPhone notch */
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

.splash-overlay.splash-hiding {
  opacity: 0;
  visibility: hidden;
}

.splash-overlay.splash-hidden {
  display: none !important;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 380px;
  padding: 2rem 2.5rem;
  animation: splashEntrance 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes splashEntrance {
  from {
    opacity: 0;
    transform: scale(0.88) translateY(16px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.splash-logo-box {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash-logo-img {
  width: 100%;
  max-width: 320px;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 8px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.splash-tagline {
  font-family: 'Calibri', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  color: #64748B;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: center;
}

.splash-loader {
  width: 180px;
  height: 3px;
  background: #E2E8F0;
  border-radius: 99px;
  overflow: hidden;
}

.splash-loader-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #E60012, #002D72);
  border-radius: 99px;
  animation: splashLoadProgress 1.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes splashLoadProgress {
  0%   { width: 0%; }
  40%  { width: 55%; }
  80%  { width: 85%; }
  100% { width: 100%; }
}

body {
  font-family: 'Calibri', 'Carlito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #FFFFFF;
  color: #1E293B;
  min-height: 100vh;
  /* --vh fallback untuk iOS Safari address bar (diset via JS) */
  min-height: calc(var(--vh, 1vh) * 100);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Mencegah iOS auto-resize teks saat rotate landscape */
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Mencegah double-tap zoom di Android lama */
  touch-action: pan-x pan-y;
}

/* Mencegah iOS auto-zoom saat focus input (font-size harus >= 16px) */
input, select, textarea {
  font-size: 16px;
}

/* Header */
.top-header {
  background-color: #FFFFFF;
  border-bottom: 2px solid #E60012; /* Garis Merah Yamaha */
  padding: 0.85rem 1.25rem;
  width: 100%;
  box-sizing: border-box;
}

/* iPhone ber-notch / Dynamic Island (mode standalone): konten tidak tertutup status bar */
.top-header {
  padding-top: calc(0.85rem + env(safe-area-inset-top, 0px));
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  width: 100%;
  box-sizing: border-box;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1 1 auto;
}

.yamaha-official-logo {
  height: 36px;
  max-height: 36px;
  width: auto;
  flex-shrink: 0;
  display: block;
}

.brand-divider {
  width: 2px;
  height: 26px;
  background-color: #E2E8F0;
  flex-shrink: 0;
}

.brand-heading {
  font-family: 'Calibri', sans-serif;
  font-size: clamp(1.1rem, 3.2vw, 1.35rem);
  font-weight: 700;
  color: #002D72;
  letter-spacing: 0.2px;
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: break-word;
  min-width: 0;
}


/* Update Info Bar & Button */
.update-info-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.update-text-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: #64748B;
  background: transparent;
  border: none;
  padding: 0.2rem 0;
  cursor: default; /* Tidak tampak seperti tombol */
  user-select: none;
  white-space: nowrap;
}

.update-label {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
  color: #64748B;
  letter-spacing: 0.2px;
}

/* Pemicu login admin tersembunyi: hanya tanda ":" yang bisa diklik, tanpa gaya tombol */
.admin-colon-trigger {
  cursor: default;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  padding: 0.4rem 0.25rem; /* area sentuh cukup untuk HP tanpa terlihat */
  margin: -0.4rem -0.25rem;
}

.update-date-value {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #334155;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.btn-upload-db {
  font-family: 'Calibri', sans-serif;
  background-color: #FFFFFF;
  color: #002D72;
  border: 1px solid #002D72;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-upload-db:hover {
  background-color: #002D72;
  color: #FFFFFF;
}

/* Tombol Informasi publik: ikon bulat kecil berwarna, selalu tampil di kiri label Update */
.btn-info-db {
  background-color: #002D72;
  color: #FFFFFF;
  border: 1px solid #002D72;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  position: relative;
  transition: all 0.15s ease;
}

.btn-info-db:hover {
  background-color: #001A4D;
  border-color: #001A4D;
  color: #FFFFFF;
}

/* Ada update informasi baru: merah + titik kuning + denyut agar menarik perhatian */
.btn-info-db.has-update {
  background-color: #E60012;
  border-color: #E60012;
  color: #FFFFFF;
  animation: infoPulse 1.6s ease-in-out infinite;
}

.btn-info-db.has-update::after {
  content: '';
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #FACC15;
  border: 2px solid #FFFFFF;
}

@keyframes infoPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(230, 0, 18, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(230, 0, 18, 0); }
}

.btn-logout-db {
  background-color: transparent;
  color: #64748B;
  border: 1px solid #CBD5E1;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-logout-db:hover {
  background-color: #FEE2E2;
  color: #DC2626;
  border-color: #FCA5A5;
}


/* Main Container */
.main-container {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem 1.25rem;
  flex: 1;
  box-sizing: border-box;
}

/* Kotak Pencarian */
.search-card {
  margin-bottom: 1.75rem;
  width: 100%;
}

.search-form {
  display: flex;
  align-items: stretch;
  border: 2px solid #002D72;
  border-radius: 8px;
  overflow: hidden;
  background-color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  width: 100%;
  box-sizing: border-box;
}

.search-input {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  padding: 0.95rem 1.15rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(0.95rem, 3.2vw, 1.15rem);
  font-weight: 600;
  letter-spacing: 0.2px;
  border: none;
  outline: none;
  color: #0F172A;
  background-color: #FFFFFF;
  box-sizing: border-box;
}

.search-input::placeholder {
  color: #94A3B8;
  font-weight: 400;
  font-size: clamp(0.9rem, 3vw, 1.05rem);
  letter-spacing: 0;
}

.btn-scan {
  font-family: 'Calibri', sans-serif;
  background-color: #F8FAFC;
  color: #002D72;
  border: none;
  border-left: 1px solid #CBD5E1;
  padding: 0 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-shrink: 0;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-scan:hover {
  background-color: #EEF2F6;
  color: #E60012;
}

.btn-search {
  font-family: 'Calibri', sans-serif;
  background-color: #E60012; /* Merah Resmi Yamaha */
  color: #FFFFFF;
  border: none;
  border-left: 1px solid #CC0010;
  padding: 0 1.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-search:hover {
  background-color: #CC0010;
}

/* State Messages & Yamaha Genuine Loading Animation */
.state-message {
  text-align: center;
  padding: 2.25rem 1rem;
  color: #64748B;
  font-size: 0.95rem;
  background-color: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  margin-top: 1.25rem;
  box-sizing: border-box;
}

.yamaha-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem;
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: 14px;
  margin-top: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 45, 114, 0.05);
}

.yamaha-loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 380px;
  width: 100%;
}

.yamaha-loading-logo-box {
  position: relative;
  width: 100%;
  max-width: 320px;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFFFFF;
  animation: yamahaLogoPulse 2s ease-in-out infinite;
}

.yamaha-loading-badge-img {
  width: 100%;
  height: auto;
  max-height: 95px;
  object-fit: contain;
  display: block;
}

.yamaha-loading-shine-sweep {
  position: absolute;
  top: 0;
  left: -150%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 30%,
    rgba(255, 255, 255, 0.9) 50%,
    rgba(255, 255, 255, 0.4) 70%,
    transparent 100%
  );
  transform: skewX(-25deg);
  animation: yamahaShineSweep 2.2s infinite ease-in-out;
  pointer-events: none;
}

@keyframes yamahaShineSweep {
  0% { left: -150%; }
  60%, 100% { left: 150%; }
}

@keyframes yamahaLogoPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 2px 8px rgba(230, 0, 18, 0.08)); }
  50% { transform: scale(1.025); filter: drop-shadow(0 4px 16px rgba(230, 0, 18, 0.22)); }
}

.yamaha-loading-bar-track {
  width: 220px;
  max-width: 80%;
  height: 4px;
  background: #E2E8F0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 1.25rem;
  position: relative;
}

.yamaha-loading-bar-active {
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, #E60012 0%, #002D72 100%);
  border-radius: 999px;
  position: absolute;
  animation: yamahaBarIndeterminate 1.6s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes yamahaBarIndeterminate {
  0% { left: -45%; width: 30%; }
  50% { left: 35%; width: 50%; }
  100% { left: 105%; width: 30%; }
}

.yamaha-loading-caption {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
  margin-top: 0.85rem;
  letter-spacing: 0.2px;
  animation: yamahaTextBlink 1.8s ease-in-out infinite;
}

@keyframes yamahaTextBlink {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; color: #002D72; }
}

/* Card Khusus: Kode Part Tidak Tersedia di Database */
.not-found-card {
  text-align: center;
  padding: 2.25rem 1.5rem;
  background-color: #FFFFFF;
  border: 1.5px solid #FCA5A5;
  border-radius: 12px;
  margin-top: 1.25rem;
  box-shadow: 0 4px 14px rgba(230, 0, 18, 0.05);
  box-sizing: border-box;
}

.not-found-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 0.95rem auto;
  background: #FFF1F2;
  border: 1.5px solid #FECDD3;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.not-found-title {
  font-family: 'Calibri', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: #991B1B;
  letter-spacing: 0.1px;
  margin-bottom: 0.65rem;
}

.not-found-code-badge {
  display: inline-block;
  background-color: #FEE2E2;
  color: #DC2626;
  border: 1px solid #FCA5A5;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  font-family: 'Calibri', monospace, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.not-found-desc {
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 580px;
  margin: 0 auto;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #E2E8F0;
  border-top-color: #E60012;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 0.75rem auto;
}

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

/* Tabel Hasil Pencarian (Desktop & Laptop) */
.desktop-table-wrapper {
  background-color: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  overflow-x: auto;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

@media (max-width: 768px) {
  .desktop-table-wrapper {
    display: none !important;
  }
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.result-table thead th {
  font-family: 'Calibri', sans-serif;
  background-color: #F8FAFC;
  color: #475569;
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0.9rem 1.15rem;
  border-bottom: 2px solid #CBD5E1;
  white-space: nowrap;
}

.result-table tbody td {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid #E2E8F0;
  font-size: 0.95rem;
  color: #0F172A;
  vertical-align: middle;
}

.result-table tbody tr:hover {
  background-color: #F8FAFC;
}

.text-right {
  text-align: right;
}

/* Format Kolom Spesifik */
.col-code {
  font-family: 'Calibri', monospace, sans-serif;
  font-size: 1.18rem;
  font-weight: 700;
  color: #002D72;
  letter-spacing: 0.5px;
}

/* Kode part tidak boleh ter-wrap di tabel desktop agar mudah dibaca & disalin */
.result-table .col-code {
  white-space: nowrap;
}

/* Footer copyright kecil di paling bawah halaman, tidak mengganggu konten */
.app-footer-copyright {
  margin: 1.75rem auto 0.9rem;
  padding: 0 1rem;
  padding-bottom: env(safe-area-inset-bottom, 0px); /* bebas dari home indicator iPhone */
  text-align: center;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.66rem;
  font-weight: 400;
  color: #94A3B8;
  letter-spacing: 0.3px;
  user-select: none;
}

/* ===== Menu Donasi: tombol kecil di atas copyright + modal QRIS navy ===== */
.donasi-footer-row {
  display: flex;
  justify-content: center;
  margin-top: 0.35rem;
}

.btn-donasi-small {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.72rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #003E71;
  background: transparent;
  border: 1px solid #B9C9DC;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-donasi-small:hover,
.btn-donasi-small:active {
  background: #003E71;
  border-color: #003E71;
  color: #FFFFFF;
}

/* Popup donasi: overlay standar aplikasi (tanpa background khusus), kartu putih bersih */
.donasi-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  margin: auto;
  background: #FFFFFF;
  border-radius: 14px;
  padding: 1.5rem 1.2rem 1.2rem;
  text-align: center;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.25);
}

.donasi-close-x {
  position: absolute;
  top: 0.4rem;
  right: 0.55rem;
  background: none;
  border: none;
  color: #94A3B8;
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.25rem;
  cursor: pointer;
}

.donasi-close-x:hover { color: #1E293B; }

.donasi-title {
  color: #002D72;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.donasi-img-wrap {
  margin: 0.9rem auto 0;
  width: min(68vw, 240px);
}

.donasi-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
}

.donasi-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.btn-donasi-download {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  background: #003E71;
  color: #FFFFFF;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(0, 62, 113, 0.25);
}

.btn-donasi-download:active { transform: translateY(1px); }

.btn-donasi-tutup {
  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  background: transparent;
  color: #475569;
  border: 1px solid #CBD5E1;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-donasi-tutup:hover { background: #F1F5F9; }

.col-partname {
  font-weight: 600;
  color: #0F172A;
  line-height: 1.35;
  letter-spacing: 0.2px;
}

.col-category {
  font-family: 'Calibri', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #475569;
  background-color: #F1F5F9;
  border: 1px solid #E2E8F0;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  display: inline-block;
  white-space: nowrap;
}

.col-price {
  font-family: 'Calibri', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #047857;
  display: block;
  white-space: nowrap;
}

/* Superseeding Code Badge */
.col-supercede {
  font-family: 'Calibri', monospace, sans-serif;
  display: inline-flex;
  align-items: center;
  background-color: #FEF3C7;
  color: #B45309;
  border: 1px solid #FCD34D;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.col-supercede:hover {
  background-color: #FDE68A;
}

.col-supercede-none {
  color: #94A3B8;
  font-weight: 500;
}

/* Tampilan Mobile (Khusus Layar HP/Smartphone) */
.mobile-cards-container {
  display: none;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
}

@media (max-width: 768px) {
  .mobile-cards-container {
    display: flex !important;
  }
}

.mobile-part-card {
  background-color: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  padding: 0.95rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
}

.m-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  width: 100%;
}

.m-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Responsif Khusus Tablet & Handphone */
@media (max-width: 768px) {
  .top-header {
    padding: 0.75rem 1rem;
  }
  .mode-navigation-bar .mode-tab-btn .tab-label-full {
    display: none;
  }
  .mode-navigation-bar .mode-tab-btn .tab-label-short {
    display: block;
  }
  .header-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  .brand-box {
    flex: 1 1 auto;
    min-width: 0;
    gap: 0.55rem;
  }
  .brand-heading {
    font-size: clamp(0.95rem, 3vw, 1.15rem);
  }
  .update-info-bar {
    flex-shrink: 1;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
    row-gap: 0.4rem;
  }
  /* HP: tombol admin jadi ikon agar header tidak melebar melebihi layar */
  .update-info-bar .btn-upload-db span {
    display: none;
  }
  .update-info-bar .btn-upload-db {
    width: 30px;
    height: 30px;
    padding: 0;
    justify-content: center;
    border-radius: 6px;
  }
  .update-info-bar .btn-logout-db {
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
  }
  .update-info-bar .update-text-group {
    font-size: 0.72rem;
  }
  .main-container {
    padding: 1.15rem 0.95rem;
  }
  /* Tampilan HP: Tombol Search dan Scan berbentuk icon rapi menyatu dalam search card */
  .btn-scan span,
  .btn-search span {
    display: none !important;
  }
  .btn-scan,
  .btn-search {
    width: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 0 !important;
    flex-shrink: 0 !important;
  }
  .btn-scan svg,
  .btn-search svg {
    width: 20px !important;
    height: 20px !important;
  }
  .mode-navigation-bar {
    gap: 0.35rem;
    padding: 4px;
    margin-bottom: 1.25rem;
  }
  .mode-tab-btn {
    padding: 0.65rem 0.5rem;
    font-size: 0.85rem;
    gap: 0.45rem;
  }
  .mode-tab-btn svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
  }
  .tab-label-wrap {
    gap: 0.35rem;
  }
}

@media (max-width: 480px) {
  .top-header {
    padding: 0.6rem 0.75rem;
  }
  .yamaha-official-logo {
    height: 26px;
    max-height: 26px;
  }
  .brand-divider {
    height: 18px;
    margin: 0 1px;
  }
  .brand-heading {
    font-size: 0.88rem;
    line-height: 1.15;
  }
  .update-text-group {
    font-size: 0.74rem;
    padding: 0;
  }
  .btn-upload-db {
    font-size: 0.72rem;
    padding: 0.3rem 0.6rem;
  }
  .main-container {
    padding: 0.9rem 0.7rem;
  }
  .search-card {
    margin-bottom: 1.15rem;
  }
  .search-input {
    padding: 0.75rem 0.8rem;
    font-size: 0.92rem;
  }
  .mode-navigation-bar {
    padding: 3px;
    gap: 3px;
    border-radius: 10px;
  }
  .mode-tab-btn {
    padding: 0.6rem 0.35rem;
    font-size: 0.8rem;
    gap: 0.35rem;
    border-radius: 7px;
  }
  /* Layar sempit: ikon disembunyikan agar label pendek tetap utuh,
     tidak terpotong ellipsis walau badge count sedang tampil. */
  .mode-tab-btn svg {
    display: none;
  }
  .tab-label-wrap {
    gap: 0.35rem;
  }
  .scanlist-count-badge {
    font-size: 0.66rem;
    padding: 0.1rem 0.4rem;
    min-width: 1.05rem;
    height: 1.05rem;
  }
  .mobile-part-card {
    padding: 0.85rem;
    gap: 0.5rem;
  }
  .col-code {
    font-size: 0.95rem;
  }
  .col-price {
    font-size: 1rem;
  }
}

@media (max-width: 360px) {
  .brand-heading {
    font-size: 0.82rem;
  }
  .mode-tab-btn {
    font-size: 0.76rem;
    padding: 0.55rem 0.25rem;
    gap: 0.3rem;
  }
  .tab-label-wrap {
    gap: 0.28rem;
  }
  .scanlist-count-badge {
    font-size: 0.62rem;
    padding: 0.08rem 0.32rem;
    min-width: 0.95rem;
    height: 0.95rem;
  }
}

/* Scanner Modal & Camera Viewport */
.scanner-card {
  max-width: 480px;
  width: 100%;
}

.scanner-badge-code39 {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: #1D4ED8;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.2px;
}

.scanner-viewport-box {
  position: relative;
  width: 100%;
  max-width: 440px;
  min-height: 250px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: #090D16;
  border: 2px solid #002D72;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

#scannerReader {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

#scannerReader video {
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  border-radius: 8px;
  object-fit: cover;
  background: #000;
}

/* Overlay Visual Guide untuk Barcode 1D Code 39 & QR Code */
.scanner-guide-overlay {
  position: absolute;
  top: 15%;
  bottom: 15%;
  left: 6%;
  right: 6%;
  pointer-events: none;
  border: 1.5px dashed rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(10, 15, 29, 0.4);
}

.scanner-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: #E60012;
  border-style: solid;
}

.scanner-corner.top-left {
  top: -2px;
  left: -2px;
  border-width: 3px 0 0 3px;
  border-top-left-radius: 4px;
}

.scanner-corner.top-right {
  top: -2px;
  right: -2px;
  border-width: 3px 3px 0 0;
  border-top-right-radius: 4px;
}

.scanner-corner.bottom-left {
  bottom: -2px;
  left: -2px;
  border-width: 0 0 3px 3px;
  border-bottom-left-radius: 4px;
}

.scanner-corner.bottom-right {
  bottom: -2px;
  right: -2px;
  border-width: 0 3px 3px 0;
  border-bottom-right-radius: 4px;
}

.scanner-laser-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(230, 0, 18, 0.1) 0%, #E60012 50%, rgba(230, 0, 18, 0.1) 100%);
  box-shadow: 0 0 10px #E60012, 0 0 4px #FF6B6B;
  animation: laserSweep 2s ease-in-out infinite;
}

@keyframes laserSweep {
  0% { top: 10%; opacity: 0.6; }
  50% { top: 90%; opacity: 1; }
  100% { top: 10%; opacity: 0.6; }
}

.scanner-status-text {
  font-size: 0.86rem;
  color: #475569;
  margin-top: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
}

/* Panel alternatif foto (fallback saat kamera live tidak tersedia) */
.scanner-alternative-box {
  margin-top: 0.65rem;
}

/* Sorotan panel alternatif saat kamera live tidak tersedia (mis. koneksi HTTP) */
.scanner-alternative-box.fallback-highlight {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  padding: 0.75rem;
  border: 1px dashed #E60012;
  border-radius: 8px;
  background: #FFF5F5;
}

.scanner-alternative-box.fallback-highlight .btn-photo-capture {
  background: #E60012;
  color: #FFFFFF;
  border-color: #E60012;
  font-weight: 600;
}

.btn-photo-capture {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #F1F5F9;
  color: #334155;
  border: 1px solid #CBD5E1;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-photo-capture:hover {
  background: #E2E8F0;
  color: #0F172A;
}

/* Tombol Tutup Mengambang di Dalam Layar Kamera Scanner */
.scanner-floating-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.scanner-floating-close-btn:hover {
  background: #E60012;
  border-color: #E60012;
  transform: scale(1.04);
}

.scanner-floating-close-btn:active {
  transform: scale(0.96);
}

/* Tombol Tutup Kamera di Modal Footer */
.btn-close-scanner-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: #FFFFFF;
  color: #DC2626;
  border: 1.5px solid #FCA5A5;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-family: 'Calibri', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-close-scanner-action:hover {
  background: #FEE2E2;
  border-color: #EF4444;
  color: #991B1B;
}

.btn-close-scanner-action:active {
  transform: scale(0.97);
}

/* Floating Scanner Toast Notification */
.scanner-toast-box {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0F172A;
  color: #FFFFFF;
  padding: 0.75rem 1.25rem;
  border-radius: 30px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  z-index: 999999;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 90vw;
  text-align: center;
}

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

.scanner-toast-box.success {
  background: #065F46;
  border: 1px solid #34D399;
  color: #FFFFFF;
}

.scanner-toast-box.error {
  background: #991B1B;
  border: 1px solid #F87171;
  color: #FFFFFF;
}

.scanner-toast-box.info {
  background: #1E293B;
  border: 1px solid #38BDF8;
  color: #FFFFFF;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: #FFFFFF;
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.modal-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #002D72;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #94A3B8;
  line-height: 1;
}

.modal-close:hover {
  color: #0F172A;
}

.modal-body {
  padding: 1.5rem;
}

.modal-info {
  font-size: 0.85rem;
  color: #475569;
  margin-bottom: 1rem;
}

.dropzone {
  border: 2px dashed #CBD5E1;
  border-radius: 8px;
  padding: 1.75rem 1rem;
  text-align: center;
  cursor: pointer;
  background: #F8FAFC;
  transition: all 0.15s;
}

.dropzone:hover {
  border-color: #002D72;
  background: #EFF6FF;
}

.drop-file-name {
  display: inline-block;
  margin-top: 0.65rem;
  background: #DBEAFE;
  color: #1E40AF;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #E2E8F0;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.btn-primary {
  background-color: #E60012;
  color: #FFFFFF;
  border: none;
  padding: 0.55rem 1.15rem;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: #F8FAFC;
  border: 1px solid #E2E8F0;
  color: #475569;
  padding: 0.55rem 1.15rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}

/* =========================================================
   Gaya Tampilan 12 Kolom & Informasi Superseding Part Yamaha
   ========================================================= */

.cell-part-code {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.col-raw-code {
  font-size: 0.75rem;
  font-family: monospace;
  color: #64748B;
  background: #F1F5F9;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  width: fit-content;
  border: 1px solid #E2E8F0;
}

.cell-part-name {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.col-model-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.76rem;
  font-weight: 600;
  color: #0369A1;
  background: #E0F2FE;
  border: 1px solid #BAE6FD;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  width: fit-content;
}

.cell-group-status {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.col-group-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  width: fit-content;
  letter-spacing: 0.3px;
}

.status-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  width: fit-content;
  text-transform: uppercase;
}

.status-pill-sm {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.status-active,
.status-normal {
  background: #DCFCE7;
  color: #15803D;
  border: 1px solid #86EFAC;
}

.status-discontinue,
.status-suspend {
  background: #FEE2E2;
  color: #B91C1C;
  border: 1px solid #FCA5A5;
}

.badge-abc-tag {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 800;
  color: #1E40AF;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  min-width: 22px;
  text-align: center;
}

.cell-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.old-price-subtext {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: #64748B;
}

.old-price-val {
  text-decoration: line-through;
  color: #94A3B8;
}

.price-diff-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
}

.diff-up {
  background: #FEF3C7;
  color: #B45309;
}

.diff-down {
  background: #DCFCE7;
  color: #15803D;
}

/* =========================================================
   Kartu Informasi Superseding (Part Pengganti)
   ========================================================= */

.superseding-card-inline {
  background: #FFFBEB;
  border: 1.5px solid #FDE68A;
  border-left: 4px solid #D97706;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 215px;
}

.superseding-badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 800;
  color: #92400E;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.superseding-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.superseding-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.superseding-code-val {
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 800;
  color: #1E293B;
  background: #FFFFFF;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  border: 1px solid #CBD5E1;
  white-space: nowrap;
}

.superseding-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1E293B;
  line-height: 1.3;
}

.superseding-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.75rem;
}

.superseding-price-val {
  color: #0F172A;
  background: #FEF3C7;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

.superseding-model-val {
  color: #0369A1;
  background: #E0F2FE;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-weight: 600;
}

.btn-goto-part {
  margin-top: 0.35rem;
  background: #D97706;
  color: #FFFFFF;
  border: none;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 5px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-goto-part:hover {
  background: #B45309;
  transform: translateY(-1px);
}

.btn-goto-part:active {
  transform: translateY(0);
}

/* Predecessor Box (Part ini menggantikan part lama) */
.predecessor-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-left: 3px solid #3B82F6;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.predecessor-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #1E40AF;
}

.predecessor-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.btn-predecessor-tag,
.btn-predecessor-link {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1D4ED8;
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-predecessor-tag:hover,
.btn-predecessor-link:hover {
  background: #DBEAFE;
}

/* Mobile Superseding Box */
.mobile-superseding-box {
  background: #FFFBEB;
  border: 1.5px solid #FCD34D;
  border-left: 4px solid #D97706;
  border-radius: 8px;
  padding: 0.75rem;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.mobile-superseding-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: #92400E;
}

.mobile-superseding-content {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.m-header-row {
  justify-content: space-between;
  align-items: flex-start;
}

/* =========================================================
   Mode Navigation Bar (Cari Part vs Scan List)
   ========================================================= */
.mode-navigation-bar {
  /* Grid 2 kolom sama rata: kolom TIDAK BISA meluap walau isi tab
     (ikon + label + badge) lebih lebar dari ruang yang tersedia,
     sehingga tab tidak pernah saling tumpang tindih di device apa pun. */
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  margin-bottom: 1.5rem;
  background: #F1F5F9;
  padding: 5px;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  width: 100%;
  box-sizing: border-box;
}

.mode-tab-btn {
  /* Jangan pakai flex-basis otomatis: isi tab (terutama badge jumlah)
     tidak boleh menentukan lebar tab. Lebar 100% mengikuti kolom grid
     dan seluruh isi dipaksa menyusut di dalamnya. */
  width: 100%;
  min-width: 0;
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: clamp(0.88rem, 2.2vw, 0.98rem);
  font-weight: 600;
  color: #64748B;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  user-select: none;
  overflow: hidden;
  max-width: 100%;
}

/* Wrapper label: satu-satunya bagian tab yang boleh menyusut (shrinkable).
   Berisi label (full/short) dan badge jumlah Scan List di dalamnya,
   sehingga badge selalu ikut menyusut dan tidak mendorong tab lain. */
.tab-label-wrap {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  overflow: hidden;
}

.tab-label-wrap > span {
  display: block;
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badge jumlah item Scan List: berada di dalam wrapper label,
   selalu menyusut (tidak flex-shrink: 0) agar tidak pernah
   meluber keluar tab dan menimpa tab "Cari Part". */
.tab-label-wrap > .scanlist-count-badge {
  flex: 0 1 auto;
  min-width: 0;
}

/* Label responsif: teks panjang untuk layar lebar, teks pendek untuk HP.
   Default: label pendek disembunyikan, label panjang tampil.
   Specificity 0,2,1 agar mengalahkan aturan `.tab-label-wrap > span` di atas.
   Override untuk layar sempit ada di @media (max-width: 768px). */
.tab-label-wrap > .tab-label-short {
  display: none;
}
.tab-label-wrap > .tab-label-full {
  display: block;
}

/* Semua child wrapper label tidak boleh meluap keluar tab. */
.mode-tab-btn .tab-label-wrap > * {
  max-width: 100%;
}

.mode-tab-btn svg {
  flex-shrink: 0;
  transition: all 0.2s ease;
  color: #64748B;
}

.mode-tab-btn:hover:not(.active) {
  color: #002D72;
  background: rgba(255, 255, 255, 0.75);
}

.mode-tab-btn.active {
  color: #002D72;
  background: #FFFFFF;
  font-weight: 700;
  border-color: #E2E8F0;
  box-shadow: 0 2px 8px rgba(0, 45, 114, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
}

.mode-tab-btn.active svg {
  color: #E60012;
  stroke: #E60012;
}

.scanlist-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #E60012;
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  min-width: 1.2rem;
  height: 1.2rem;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(230, 0, 18, 0.3);
  /* Tidak flex-shrink: 0 — badge harus boleh menyusut supaya tidak
     mendorong/menimpa tab sebelahnya saat jumlah item banyak. */
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
   Scan List Header Bar & Reset Action
   ========================================================= */
.scanlist-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
}

.scanlist-header-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.scanlist-badge-title {
  font-family: 'Calibri', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  color: #002D72;
}

.scanlist-note-inline {
  font-size: 0.8rem;
  color: #64748B;
  font-weight: 500;
}

.btn-reset-scanlist {
  background: #FFFFFF;
  color: #64748B;
  border: 1.5px solid #CBD5E1;
  padding: 0.45rem 0.85rem;
  font-family: 'Calibri', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-reset-scanlist:hover {
  background: #FEE2E2;
  color: #DC2626;
  border-color: #FCA5A5;
}

.scanlist-manual-input {
  border: none;
  outline: none;
  font-family: 'Calibri', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: #0F172A;
  background: transparent;
}

.scanlist-manual-input::placeholder {
  color: #94A3B8;
  font-weight: 400;
}

.btn-add-manual {
  background: #002D72;
  color: #FFFFFF;
  border: none;
  padding: 0 1.15rem;
  font-family: 'Calibri', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.btn-add-manual:hover {
  background: #001E4D;
}

.scanlist-feedback-msg {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
}

.scanlist-feedback-msg.success {
  background: #ECFDF5;
  color: #047857;
  border: 1px solid #A7F3D0;
}

.scanlist-feedback-msg.error {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

/* =========================================================
   Panel Hasil Pencarian Manual di Scan List
   ========================================================= */
.scanlist-search-results-card {
  background: #FFFFFF;
  border: 1.5px solid #002D72;
  border-radius: 10px;
  margin-top: -1rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 16px rgba(0, 45, 114, 0.1);
  overflow: hidden;
  animation: searchResultsFadeIn 0.2s ease-out;
}

@keyframes searchResultsFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-results-header {
  background: #EFF6FF;
  border-bottom: 1px solid #BFDBFE;
  padding: 0.6rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.search-results-title {
  font-family: 'Calibri', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: #002D72;
}

.search-results-count {
  background: #002D72;
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.btn-close-results {
  background: transparent;
  border: none;
  font-size: 1.35rem;
  line-height: 1;
  color: #64748B;
  cursor: pointer;
  padding: 0 0.25rem;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.btn-close-results:hover {
  color: #DC2626;
}

.search-results-body {
  max-height: 320px;
  overflow-y: auto;
  divide-y: 1px solid #F1F5F9;
}

.search-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid #F1F5F9;
  gap: 1rem;
  transition: background-color 0.12s ease;
}

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

.search-item-row:hover {
  background-color: #F8FAFC;
}

.search-item-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.search-item-code-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.search-item-name {
  font-family: 'Calibri', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: #1E293B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-meta {
  font-size: 0.78rem;
  color: #64748B;
  display: flex;
  gap: 0.75rem;
}

.search-item-price-action {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.search-item-price {
  font-family: 'Calibri', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  color: #002D72;
}

.btn-pick-add-part {
  background: #002D72;
  color: #FFFFFF;
  border: none;
  padding: 0.45rem 0.85rem;
  font-family: 'Calibri', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-pick-add-part:hover {
  background: #E60012;
  transform: translateY(-1px);
}

.btn-pick-add-part:active {
  transform: translateY(0);
}

/* Empty State Scan List */
.scanlist-empty-card {
  background: #FFFFFF;
  border: 2px dashed #CBD5E1;
  border-radius: 12px;
  padding: 3rem 1.5rem;
  text-align: center;
  margin: 1.5rem 0;
}

.scanlist-empty-icon {
  margin-bottom: 0.75rem;
}

.scanlist-empty-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #334155;
  margin-bottom: 0.4rem;
}

.scanlist-empty-desc {
  font-size: 0.9rem;
  color: #64748B;
  max-width: 500px;
  margin: 0 auto 1.25rem auto;
  line-height: 1.5;
}

/* Qty Controls in Scan List Table */
.qty-control-group {
  display: inline-flex;
  align-items: center;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  overflow: hidden;
}

.btn-qty-mini {
  background: #FFFFFF;
  border: none;
  color: #0F172A;
  font-size: 0.9rem;
  font-weight: 800;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease;
}

.btn-qty-mini:hover {
  background: #E2E8F0;
}

.qty-number-input {
  width: 38px;
  text-align: center;
  border: none;
  background: transparent;
  font-family: 'Calibri', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0F172A;
  padding: 0 2px;
  outline: none;
}

.qty-number-input::-webkit-outer-spin-button,
.qty-number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.btn-delete-row {
  background: #FEE2E2;
  color: #DC2626;
  border: 1px solid #FECACA;
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-delete-row:hover {
  background: #DC2626;
  color: #FFFFFF;
}

/* Scan List Summary / Grand Total Box */
.scanlist-summary-card {
  background: #FFFFFF;
  border: 2px solid #002D72;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-top: 1.5rem;
  box-shadow: 0 4px 14px rgba(0, 45, 114, 0.08);
}

.summary-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1.5px dashed #CBD5E1;
}

.summary-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.summary-meta-label {
  font-size: 0.8rem;
  color: #64748B;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-meta-value {
  font-size: 1.15rem;
  color: #0F172A;
  font-weight: 800;
}

/* Bagian Kontrol Diskon */
.discount-control-section {
  background: #F8FAFC;
  border: 1px dashed #CBD5E1;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
}

.discount-control-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.discount-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1E293B;
}

.discount-type-toggle {
  display: inline-flex;
  background: #E2E8F0;
  border-radius: 6px;
  padding: 2px;
}

.btn-discount-type {
  border: none;
  background: transparent;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-discount-type.active {
  background: #002D72;
  color: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.discount-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.discount-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 130px;
}

.discount-prefix {
  position: absolute;
  left: 0.6rem;
  font-weight: 700;
  font-size: 0.82rem;
  color: #64748B;
  pointer-events: none;
}

.discount-input {
  width: 100%;
  padding: 0.4rem 0.5rem 0.4rem 1.65rem;
  border: 1.5px solid #CBD5E1;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #0F172A;
  background: #FFFFFF;
  outline: none;
  transition: border-color 0.15s;
}

.discount-input:focus {
  border-color: #002D72;
}

.discount-presets {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.btn-discount-preset {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #334155;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-discount-preset:hover {
  background: #EFF6FF;
  border-color: #002D72;
  color: #002D72;
}

.btn-discount-preset.active {
  background: #002D72;
  border-color: #002D72;
  color: #FFFFFF;
}

/* Breakdown Box Ringkasan Total & Diskon */
.summary-breakdown-box {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-left: auto;
  min-width: 240px;
}

.summary-breakdown-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.summary-breakdown-row.discount-row {
  color: #DC2626;
  font-size: 0.9rem;
}

.summary-breakdown-row.grand-total-row {
  border-top: 1.5px solid #E2E8F0;
  padding-top: 0.4rem;
  margin-top: 0.2rem;
}

.breakdown-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
}

.breakdown-val {
  font-size: 1rem;
  font-weight: 800;
  color: #0F172A;
}

.breakdown-val.discount-val {
  color: #DC2626;
}

.breakdown-val.grand-val {
  font-size: clamp(1.25rem, 3.5vw, 1.65rem);
  font-weight: 900;
  color: #E60012;
}

.summary-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 1rem;
}

.summary-note-text {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #64748B;
  font-weight: 500;
}

.summary-action-buttons {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn-copy-wa {
  background: #25D366;
  color: #FFFFFF;
  border: none;
  padding: 0.55rem 1rem;
  font-family: 'Calibri', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.15s ease;
}

.btn-copy-wa:hover {
  background: #1EBE5D;
  transform: translateY(-1px);
}

.btn-print-invoice {
  background: #002D72;
  color: #FFFFFF;
  border: none;
  padding: 0.55rem 1rem;
  font-family: 'Calibri', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.15s ease;
}

.btn-print-invoice:hover {
  background: #001A44;
  transform: translateY(-1px);
}

/* Continuous Scan Live Feedback Banner in Modal */
.continuous-feedback-banner {
  background: #ECFDF5;
  border: 1.5px solid #10B981;
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: feedbackSlideDown 0.25s ease-out;
}

@keyframes feedbackSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.feedback-icon-box {
  width: 24px;
  height: 24px;
  background: #10B981;
  color: #FFFFFF;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.feedback-info-text {
  flex: 1;
  text-align: left;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.feedback-info-text strong {
  color: #065F46;
  font-size: 0.95rem;
}

.feedback-info-text span {
  color: #047857;
  font-size: 0.78rem;
  font-weight: 600;
}

.feedback-total-count {
  background: #047857;
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* Elemen Header & Footer Nota Print (Default Hidden di Layar Normal) */
.print-invoice-header,
.print-invoice-footer {
  display: none;
}

/* =========================================================
   MOBILE IMPROVEMENTS — Android & iPhone Safe Area + Touch
   ========================================================= */

/* Body safe area untuk iPhone X+ (notch & home indicator) */
body {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Sembunyikan splash saat print */
@media print {
  .splash-overlay { display: none !important; }
}

/* ===== Mobile Comprehensive Fixes (max-width: 640px) ===== */
@media (max-width: 640px) {

  /* === Header mobile === */
  .top-header {
    position: -webkit-sticky;
  position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  }

  /* === Search Form === */
  .search-form {
    border-radius: 10px;
  }

  .search-input {
    font-size: 1rem;
    padding: 0.9rem 0.85rem;
  }

  .btn-scan,
  .btn-search {
    /* Minimum touch target 44px sesuai Apple HIG */
    min-height: 44px;
    min-width: 44px;
  }

  /* === Mode Tab Navigation === */
  .mode-navigation-bar {
    position: -webkit-sticky;
  position: sticky;
    top: 58px; /* di bawah header */
    z-index: 99;
    background: #F8FAFC;
    margin-left: -0.7rem;
    margin-right: -0.7rem;
    padding: 6px 8px;
    border-radius: 0;
    border-bottom: 1px solid #E2E8F0;
    margin-bottom: 1.25rem;
  }

  .mode-tab-btn {
    min-height: 40px;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    /* Kunci anti-overlap di mobile: lebar tab murni dari grid,
       isi tab tidak boleh melebarkan tab. */
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .mode-tab-btn .tab-label-wrap {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .mode-tab-btn svg {
    flex-shrink: 0;
  }

  /* === Scan List Section === */
  .scanlist-header-bar {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .scanlist-badge-title {
    font-size: 0.9rem;
  }

  .scanlist-note-inline {
    font-size: 0.72rem;
    display: block;
    width: 100%;
  }

  .btn-reset-scanlist {
    width: 100%;
    justify-content: center;
  }

  /* === Summary action buttons === */
  .summary-action-buttons {
    width: 100%;
    flex-direction: row;
    justify-content: stretch;
    gap: 0.6rem;
  }

  .btn-copy-wa,
  .btn-print-invoice {
    flex: 1;
    justify-content: center;
    min-height: 44px;
    font-size: 0.82rem;
    padding: 0.6rem 0.75rem;
  }

  /* === Discount control mobile === */
  .discount-control-section {
    padding: 0.85rem;
  }

  .discount-input-row {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }

  .discount-input-wrapper {
    width: 100%;
  }

  .discount-input {
    width: 100%;
    font-size: 1rem;
    min-height: 44px;
  }

  .discount-presets {
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-start;
  }

  .btn-discount-preset {
    min-height: 38px;
    padding: 0.4rem 1rem;
  }

  .discount-type-toggle {
    display: flex;
    gap: 0.35rem;
  }

  .btn-discount-type {
    min-height: 36px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }

  /* === Summary card === */
  .scanlist-summary-card {
    padding: 1rem;
    border-radius: 12px;
  }

  .summary-top-row {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .summary-breakdown-box {
    width: 100%;
    min-width: 0;
  }

  .summary-breakdown-row {
    padding: 0.35rem 0;
  }

  .breakdown-val.grand-val {
    font-size: 1.25rem;
  }

  /* === Mobile part cards qty controls === */
  .qty-control-group {
    gap: 0.35rem;
  }

  .btn-qty-mini {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    font-size: 1.1rem;
    border-radius: 6px;
    touch-action: manipulation;
  }

  .qty-number-input {
    width: 50px;
    height: 36px;
    font-size: 1rem;
    min-height: 36px;
  }

  /* === Search result card (scan list manual) === */
  .search-item-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.9rem;
  }

  .search-item-price-action {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .btn-pick-add-part {
    min-height: 40px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }

  /* === Scanner Modal Mobile === */
  .scanner-card {
    max-width: 100%;
    width: 100%;
    max-height: 95vh;
    height: 95vh;
    height: 95dvh;
    margin: 0;
    border-radius: 16px 16px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  /* Khusus modal admin & upload — center di mobile */
  #modalAdminAuth .modal-card,
  #modalUpload .modal-card {
    margin: 1rem;
    border-radius: 16px;
    max-width: calc(100% - 2rem);
    width: 100%;
  }

  .modal-header {
    padding: 1rem 1.1rem 0.85rem;
  }

  .modal-body {
    padding: 0.85rem 1.1rem;
    max-height: 70vh;
    height: 70dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .scanner-viewport-box {
    min-height: 200px;
    height: 45vh;
    max-height: 45vh;
    height: 45dvh;
    max-height: 45dvh;
  }

  .scanner-alternative-box {
    justify-content: center;
    padding: 0.35rem 0;
  }

  .btn-photo-capture {
    min-height: 44px;
    padding: 0.6rem 1.25rem;
    font-size: 0.85rem;
    width: 100%;
    justify-content: center;
    background: #EFF6FF;
    color: #1D4ED8;
    border-color: #BFDBFE;
  }

  .btn-photo-capture:hover,
  .btn-photo-capture:active {
    background: #DBEAFE;
  }

  .modal-footer {
    padding: 0.75rem 1.1rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .btn-close-scanner-action {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    margin-left: 0 !important;
    order: 3;
  }

  .scanner-status-text {
    font-size: 0.8rem;
    line-height: 1.45;
    padding: 0.5rem 0.25rem;
  }

  .scanner-floating-close-btn {
    top: 8px;
    right: 8px;
    padding: 0.3rem 0.6rem;
    font-size: 0.72rem;
  }

  /* === Scan List search result card mobile === */
  .scanlist-search-results-card {
    border-radius: 10px;
    margin-bottom: 1rem;
  }

  .scanlist-search-results-card .search-results-body {
    max-height: 55vh;
  }

  /* === Not Found Card mobile === */
  .not-found-card {
    padding: 1.5rem 1rem;
  }

  /* === Mobile card delete button === */
  .btn-delete-row {
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem;
    border-radius: 6px;
  }
}

/* ===== iPhone SE / Kecil (max-width: 375px) ===== */
@media (max-width: 375px) {
  .splash-content {
    padding: 1.5rem 1.75rem;
    gap: 1.15rem;
  }

  .splash-logo-img {
    max-width: 260px;
  }

  .tab-label-wrap > span {
    font-size: 0.78rem;
  }

  .summary-action-buttons {
    flex-direction: column;
  }

  .btn-copy-wa,
  .btn-print-invoice {
    width: 100%;
  }
}

/* ===== Landscape mobile ===== */
@media (max-height: 500px) and (orientation: landscape) {
  .scanner-card {
    border-radius: 12px;
    max-height: 90vh;
    height: 90vh;
    height: 90dvh;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    bottom: auto;
    width: calc(100% - 2rem);
    max-width: 520px;
  }

  .modal-overlay {
    align-items: center;
  }

  .scanner-viewport-box {
    min-height: 150px;
    height: 35vh;
    max-height: 35vh;
    height: 35dvh;
    max-height: 35dvh;
  }
}

/* =========================================================
   Print Styling (Khusus Cetak Nota Estimasi Bersih & Rapi)
   ========================================================= */
@media print {
  @page {
    margin: 1.2cm 1cm;
    size: auto;
  }

  *, *::before, *::after {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    background: #FFFFFF !important;
    color: #000000 !important;
    font-family: 'Calibri', 'Inter', Arial, sans-serif !important;
    font-size: 10pt !important;
    line-height: 1.3 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Sembunyikan SEMUA elemen UI web / kontrol interaktif saat print */
  .top-header,
  .mode-navigation-bar,
  .search-card,
  #formScanListManual,
  .scanlist-header-bar,
  .scanlist-feedback-msg,
  .scanlist-search-results-card,
  .discount-control-section,
  .summary-action-buttons,
  .summary-note-text,
  .modal-overlay,
  .btn-delete-row,
  .btn-qty-mini,
  .col-action-header,
  .scanlist-empty-card,
  #viewSearchMode {
    display: none !important;
  }

  #viewScanListMode {
    display: block !important;
  }

  .main-container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Tampilkan Header Resmi Nota */
  .print-invoice-header {
    display: block !important;
    margin-bottom: 1.2rem !important;
  }

  .print-header-top {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
  }

  .print-brand-title {
    font-size: 14pt !important;
    font-weight: 900 !important;
    color: #000000 !important;
    letter-spacing: 0.5px !important;
  }

  .print-brand-subtitle {
    font-size: 11pt !important;
    font-weight: 700 !important;
    color: #333333 !important;
    margin-top: 2px !important;
  }

  .print-meta {
    text-align: right !important;
    font-size: 9pt !important;
    color: #222222 !important;
    line-height: 1.4 !important;
  }

  .print-meta-row span {
    color: #555555 !important;
  }

  .print-divider {
    border-bottom: 2px solid #000000 !important;
    margin-top: 0.6rem !important;
  }

  /* Tabel Daftar Suku Cadang Bersih */
  .desktop-table-wrapper.scanlist-table-wrapper {
    display: block !important;
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .scanlist-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-bottom: 1rem !important;
  }

  .scanlist-table th {
    background: #F1F5F9 !important;
    color: #000000 !important;
    border: 1px solid #000000 !important;
    padding: 6px 8px !important;
    font-size: 9pt !important;
    font-weight: 700 !important;
    text-align: left !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .scanlist-table td {
    border: 1px solid #444444 !important;
    padding: 5px 8px !important;
    font-size: 9pt !important;
    color: #000000 !important;
    vertical-align: middle !important;
  }

  /* Sembunyikan kolom aksi saat print */
  .scanlist-table th:last-child,
  .scanlist-table td:last-child {
    display: none !important;
  }

  /* Kuantitas di print tampil bersih tanpa tombol */
  .qty-control-group {
    display: inline-block !important;
    text-align: center !important;
  }

  .qty-number-input {
    border: none !important;
    background: transparent !important;
    font-weight: 700 !important;
    font-size: 9pt !important;
    color: #000000 !important;
    width: auto !important;
    text-align: center !important;
    padding: 0 !important;
  }

  .col-code {
    font-weight: 700 !important;
    color: #000000 !important;
  }

  .col-partname {
    color: #000000 !important;
  }

  .col-group-tag {
    background: transparent !important;
    border: none !important;
    color: #333333 !important;
    padding: 0 !important;
    font-size: 8.5pt !important;
  }

  /* Mobile cards disembunyikan saat cetak desktop */
  .mobile-cards-container {
    display: none !important;
  }

  /* Kotak Rekapitulasi Summary Nota */
  .scanlist-summary-card {
    background: transparent !important;
    border: 1px solid #000000 !important;
    border-radius: 0 !important;
    padding: 0.75rem 1rem !important;
    margin-top: 0.75rem !important;
    page-break-inside: avoid !important;
  }

  .summary-top-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-end !important;
  }

  .summary-meta-item {
    font-size: 9pt !important;
  }

  .summary-meta-value {
    color: #000000 !important;
    font-size: 10pt !important;
  }

  .summary-breakdown-box {
    margin-left: auto !important;
    min-width: 220px !important;
  }

  .summary-breakdown-row {
    font-size: 9.5pt !important;
    margin-bottom: 2px !important;
  }

  .breakdown-label {
    color: #333333 !important;
  }

  .breakdown-val {
    color: #000000 !important;
    font-size: 9.5pt !important;
  }

  .breakdown-val.discount-val {
    color: #000000 !important;
  }

  .breakdown-val.grand-val {
    font-size: 12pt !important;
    font-weight: 900 !important;
    color: #000000 !important;
    border-bottom: 3px double #000000 !important;
  }

  /* Tampilkan Footer Nota & Tanda Tangan */
  .print-invoice-footer {
    display: block !important;
    margin-top: 1.5rem !important;
    page-break-inside: avoid !important;
  }

  .print-notes-section {
    font-size: 8pt !important;
    color: #555555 !important;
    line-height: 1.35 !important;
    border-top: 1px dashed #666666 !important;
    padding-top: 0.5rem !important;
    margin-bottom: 1.5rem !important;
  }

  .print-note-item {
    margin: 2px 0 !important;
  }

  .print-signature-grid {
    display: flex !important;
    justify-content: space-between !important;
    margin-top: 1rem !important;
    padding: 0 1.5rem !important;
  }

  .print-sign-box {
    text-align: center !important;
    width: 200px !important;
  }

  .sign-title {
    font-size: 9pt !important;
    font-weight: 600 !important;
    color: #000000 !important;
  }

  .sign-space {
    height: 55px !important;
  }

  .sign-line {
    font-size: 9pt !important;
    color: #000000 !important;
  }
}



/* ===== Dark Mode (khusus mobile <=768px), di-toggle via tombol bulan/matahari ===== */
.btn-dark-toggle {
  display: none;
  background-color: #FFFFFF;
  color: #002D72;
  border: 1px solid #CBD5E1;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}

@media (max-width: 768px) {
  .btn-dark-toggle { display: inline-flex; }

  body.dark-mode { background: #0B1220; color: #E5EAF3; }
  body.dark-mode .top-header { background: #151E2E; }
  body.dark-mode .brand-heading { color: #E5EAF3; }
  body.dark-mode .update-label { color: #9AA7BB; }
  body.dark-mode .update-date-value { color: #CBD5E1; }
  body.dark-mode .btn-info-db { background: #1C2739; border-color: #2C3A4F; color: #9AA7BB; }
  body.dark-mode .btn-dark-toggle { background: #1C2739; border-color: #2C3A4F; color: #FACC15; }
  body.dark-mode .btn-upload-db { background: #1C2739; border-color: #3B82F6; color: #93C5FD; }
  body.dark-mode .btn-logout-db { color: #9AA7BB; }
  body.dark-mode .search-card { background: #151E2E; border-color: #2C3A4F; }
  body.dark-mode .search-input { background: #0B1220; border-color: #2C3A4F; color: #E5EAF3; }
  body.dark-mode .search-input::placeholder { color: #64748B; }
  body.dark-mode .btn-search, body.dark-mode .btn-scan { background: #1C2739; color: #E5EAF3; border-color: #2C3A4F; }
  body.dark-mode .mode-navigation-bar { background: #151E2E; border-color: #2C3A4F; }
  body.dark-mode .mode-tab-btn { color: #9AA7BB; }
  body.dark-mode .mode-tab-btn.active { background: #1C2739; color: #E5EAF3; }
  body.dark-mode .result-table th { background: #1C2739; color: #9AA7BB; border-color: #2C3A4F; }
  body.dark-mode .result-table td { border-color: #2C3A4F; color: #CBD5E1; }
  body.dark-mode .result-table tbody tr { background: #151E2E; }
  body.dark-mode .col-code { color: #E5EAF3; }
  body.dark-mode .col-partname { color: #CBD5E1; }
  body.dark-mode .col-price { color: #F87171; }
  body.dark-mode .col-group-tag, body.dark-mode .badge-abc-tag { background: #1C2739; color: #9AA7BB; border-color: #2C3A4F; }
  body.dark-mode .mobile-part-card { background: #151E2E; border-color: #2C3A4F; }
  body.dark-mode .m-label { color: #9AA7BB; }
  body.dark-mode .status-pill.status-active { background: #052E16; color: #4ADE80; }
  body.dark-mode .status-pill.status-discontinue { background: #450A0A; color: #FCA5A5; }
  body.dark-mode .modal-card { background: #151E2E; color: #E5EAF3; }
  body.dark-mode .modal-header { border-color: #2C3A4F; }
  body.dark-mode .modal-header h3 { color: #E5EAF3; }
  body.dark-mode .modal-info { color: #9AA7BB; }
  body.dark-mode .modal-body { color: #CBD5E1; }
  body.dark-mode .form-input { background: #0B1220; border-color: #2C3A4F; color: #E5EAF3; }
  body.dark-mode .btn-secondary { background: #1C2739; border-color: #2C3A4F; color: #CBD5E1; }
  body.dark-mode .dropzone { background: #0B1220; border-color: #2C3A4F; }
  body.dark-mode .scanlist-summary-card, body.dark-mode .scanlist-search-results-card,
  body.dark-mode .scanlist-empty-card { background: #151E2E; border-color: #2C3A4F; color: #CBD5E1; }
  body.dark-mode .scanlist-header-bar { background: #1C2739; }
  body.dark-mode .scanlist-empty-title { color: #E5EAF3; }
  body.dark-mode .scanlist-empty-desc { color: #9AA7BB; }
  body.dark-mode .predecessor-box { background: #1C2739; border-color: #2C3A4F; }
  body.dark-mode .btn-predecessor-tag { background: #0B1220; color: #93C5FD; border-color: #2C3A4F; }
  body.dark-mode .app-footer-copyright { color: #64748B; }
  body.dark-mode .donasi-footer-row button { color: #9AA7BB; }
  /* Permukaan terang inline (kartu info/manajemen/statistik/upload) ikut gelap, kecuali nota */
  body.dark-mode [style*="background:#F8FAFC"]:not(#invoice):not(#invoice *),
  body.dark-mode [style*="background: #F8FAFC"]:not(#invoice):not(#invoice *),
  body.dark-mode [style*="background:#F1F5F9"]:not(#invoice):not(#invoice *),
  body.dark-mode [style*="background:#fff"]:not(#invoice):not(#invoice *),
  body.dark-mode [style*="background:#FFFFFF"]:not(#invoice):not(#invoice *) {
    background: #1C2739 !important;
    color: #CBD5E1 !important;
    border-color: #2C3A4F !important;
  }
  body.dark-mode #infoViewBox { background: #0B1220 !important; border-color: #2C3A4F !important; color: #E5EAF3 !important; }
}
