/* Agata Group PWA Stylesheet - Modern Glassmorphism & Slate Design System */

:root {
  --primary: #2563eb; /* Royal Blue */
  --primary-hover: #1d4ed8;
  --secondary: #eab308; /* Golden Yellow */
  --secondary-hover: #ca8a04;
  --accent: #ef4444; /* Crimson Red */
  --accent-hover: #dc2626;
  --danger: #f43f5e; /* Rose Red */
  --danger-hover: #e11d48;
  --bg-dark: #f8fafc; /* Clean Light Background */
  --bg-card: #ffffff; /* Solid White Card */
  --text-main: #0f172a; /* Slate 900 */
  --text-muted: #64748b; /* Slate 500 */
  --border-color: #cbd5e1; /* Slate 300 */
  --transition-speed: 0.25s;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  background-image: radial-gradient(circle at 15% 15%, rgba(37, 99, 235, 0.04) 0%, transparent 45%),
                    radial-gradient(circle at 85% 85%, rgba(234, 179, 8, 0.03) 0%, transparent 45%),
                    radial-gradient(circle at 50% 50%, rgba(239, 68, 68, 0.02) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Glassmorphism Panel Container */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 4px 20px 0 rgba(15, 23, 42, 0.06);
}

/* Auth View Styles */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 40px 30px;
  text-align: center;
}

.auth-logo {
  font-family: 'Orbitron', sans-serif;
  font-size: 32px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 3px;
  margin-bottom: 8px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #2563eb, #eab308, #ef4444);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.auth-logo-img {
  max-width: 280px;
  width: 100%;
  height: auto;
  aspect-ratio: 1024 / 158;
  margin-bottom: 12px;
  display: inline-block;
}

.auth-subtitle {
  color: #1e293b; /* Slate 800 - bolder and high-contrast */
  font-weight: 700; /* Bold/tebal */
  font-size: 15px;
  margin-bottom: 35px;
}

/* Main Layout Styles */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  background: #1a4ba9;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.logo-text {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-style: italic;
  font-size: 20px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #ffffff;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-info {
  text-align: right;
  font-size: 13px;
}

.user-info .name {
  font-weight: 600;
  color: #ffffff;
}

.user-info .role {
  color: rgba(255, 255, 255, 0.75);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Grid & Layout Units */
.main-content {
  flex-grow: 1;
  padding: 24px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* Form Styles */
.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition-speed);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Custom Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  transition: all var(--transition-speed);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}
.btn-secondary:hover {
  background: var(--secondary-hover);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.btn-outline:hover {
  background: rgba(15, 23, 42, 0.04);
  border-color: var(--text-muted);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

.action-buttons-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

/* Tabs & Panels navigation */
.tab-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  overflow-x: auto;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  text-decoration: none;
  display: inline-block;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  white-space: nowrap;
  transition: all var(--transition-speed);
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(15, 23, 42, 0.04);
}

.tab-btn.active {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  border-bottom: 2px solid var(--primary);
  border-radius: 6px 6px 0 0;
}

/* Tables & Lists */
.table-container {
  overflow-x: auto;
  margin-bottom: 20px;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.custom-table th {
  background: rgba(15, 23, 42, 0.03);
  padding: 10px 14px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.custom-table th[onclick] {
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.custom-table th[onclick]:hover {
  background: rgba(15, 23, 42, 0.07);
  color: var(--primary);
}

.custom-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  white-space: normal;
  word-wrap: break-word;
  word-break: break-word;
}

.custom-table tbody tr:hover {
  background: rgba(15, 23, 42, 0.01);
}

/* Prevent wrapping for badges, status, and action controls in tables */
.custom-table .role,
.custom-table .badge-blink,
.custom-table .badge-processed,
.custom-table td[data-label="Status"],
.custom-table td[data-label="Status PIN"],
.custom-table td[data-label="Kegiatan"],
.custom-table td[data-label="No. Ref"],
.custom-table td[data-label="Tanggal"],
.custom-table td[data-label="Nominal"],
.custom-table td[data-label="Email"],
.custom-table td[data-label="No. WhatsApp"],
.custom-table td[data-label="No. Rekening"],
.custom-table td[data-label="SKU"],
.custom-table td[data-label="Satuan"],
.custom-table td[data-label="Stok"],
.custom-table td[data-label="Cabang"],
.custom-table td[data-label="Kota/Cabang"],
.custom-table td[data-label="Karyawan"],
.custom-table td[data-label="Customer"],
.custom-table td[data-label="Nama Toko"] {
  white-space: nowrap !important;
  word-break: normal !important;
  word-wrap: normal !important;
}

/* Modal Popup validation PIN & General Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-speed);
  padding: 16px 10px;
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 92%;
  max-width: 400px;
  padding: 24px;
  text-align: center;
  box-sizing: border-box;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Specific modal card scroll & layout optimizations */
.modal-card.glass-panel {
  max-height: 90vh !important;
  max-height: 90dvh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain;
}

/* Edit Order Item Row Responsive Design */
.edit-ord-item-row {
  display: grid;
  grid-template-columns: 2.2fr 0.8fr 1.2fr 1.2fr auto;
  gap: 8px;
  align-items: center;
  background: rgba(0, 0, 0, 0.02);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  transition: all var(--transition-speed);
}

.edit-ord-item-row .row-mobile-controls {
  display: contents;
}

/* Edit Payment Detail Row Responsive Design */
.edit-pay-row {
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(0, 0, 0, 0.02);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

/* Sticky Modal Footer for Total & Action Buttons */
.modal-sticky-footer {
  position: sticky;
  bottom: -24px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px 0 16px 0;
  margin-top: 15px;
  border-top: 1px solid var(--border-color);
  z-index: 20;
}

#confirm-modal-message {
  text-align: center !important;
  white-space: normal !important;
}


.pin-inputs {
  display: flex;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  margin: 20px auto;
}

.pin-digit {
  width: clamp(35px, 9vw, 44px);
  height: clamp(45px, 11vw, 54px);
  font-size: clamp(20px, 5vw, 24px);
  font-weight: 700;
  text-align: center;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-main);
  transition: all var(--transition-speed);
}

.pin-digit:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

/* Card grids for Back-Office Dashboard */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.summary-card {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.summary-card .value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 5px;
}

.summary-card .label {
  font-size: 13px;
  color: var(--text-muted);
}

/* Notification banner */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 16px 24px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all var(--transition-speed);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-success {
  background: #10b981;
  color: white;
}

.toast-error {
  background: #ef4444;
  color: white;
}

.toast-warning {
  background: #f59e0b;
  color: white;
}

/* Dynamic product row grids */
.item-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1.5fr 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

/* Responsive fixes */
.tab-bar::-webkit-scrollbar {
  height: 5px;
}

.tab-bar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}

/* Forms inside tab content get a responsive grid on desktop/laptop */
.tab-content form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 15px 24px;
}

/* Ensure full width for sections, rows, and buttons in grids */
.tab-content form > .form-group:not(.half-width),
.tab-content form > button,
.tab-content form > #order-items-container,
.tab-content form > #invoice-items-container,
.tab-content form > #branch-accounts-container,
.tab-content form > h3,
.tab-content form > h4,
.tab-content form > div[style*="border-top"],
.tab-content form > div[style*="display: grid"],
.tab-content form > div[style*="display: flex"],
.tab-content form > .glass-panel {
  grid-column: 1 / -1;
}

@media (max-width: 1024px) {
  /* Tablet layout optimizations */
  .main-content {
    padding: 16px;
  }
  .summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
  }
  .tab-bar {
    margin-bottom: 20px;
    gap: 6px;
  }
  .tab-btn {
    padding: 8px 14px;
    font-size: 13px;
  }
  /* Customer, Cabang, Laporan Kunjungan tables for tablet */
  #panel-master-customers .custom-table,
  #panel-master-branches .custom-table,
  #panel-reports .custom-table {
    font-size: 12px;
  }
  #panel-master-customers .custom-table th,
  #panel-master-customers .custom-table td,
  #panel-master-branches .custom-table th,
  #panel-master-branches .custom-table td,
  #panel-reports .custom-table th,
  #panel-reports .custom-table td {
    padding: 10px 12px;
  }
}

@media(max-width: 768px) {
  /* Mobile layout & container padding optimizations */
  .main-content {
    padding: 12px 8px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  .glass-panel:not(.modal-card) {
    padding: 16px 12px !important;
    border-radius: 12px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .modal-overlay {
    padding: 12px 6px !important;
    align-items: flex-start !important;
  }

  .modal-card.glass-panel {
    padding: 16px 12px !important;
    border-radius: 14px !important;
    width: 96% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    max-height: 90dvh !important;
    max-height: 90vh !important;
    -webkit-overflow-scrolling: touch !important;
    margin: auto 0 !important;
  }

  .modal-sticky-footer {
    bottom: -16px !important;
    padding: 10px 0 6px 0 !important;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05) !important;
  }

  /* Responsive Item Rows for Edit Order & Payment */
  .edit-ord-item-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    align-items: stretch !important;
    padding: 12px !important;
    background: var(--bg-card) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
  }

  .edit-ord-item-row .row-mobile-product {
    width: 100% !important;
  }

  .edit-ord-item-row .row-mobile-controls {
    display: grid !important;
    grid-template-columns: 80px 1fr auto auto !important;
    gap: 6px !important;
    align-items: center !important;
    width: 100% !important;
  }

  .edit-ord-item-row .edit-ord-subtotal-text {
    font-size: 13px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    padding: 0 4px !important;
  }

  .edit-pay-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    align-items: stretch !important;
    padding: 12px !important;
    background: var(--bg-card) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
  }

  .edit-pay-row .edit-pay-amount-wrap {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
    width: 100% !important;
  }

  /* Panel Header & Button Wrap for Mobile */
  .glass-panel > div[style*="display: flex"]:first-child,
  .glass-panel > div[style*="display:flex"]:first-child,
  .panel-header-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .glass-panel > div[style*="display: flex"]:first-child > h2,
  .glass-panel > div[style*="display: flex"]:first-child > h3,
  .glass-panel > div[style*="display:flex"]:first-child > h2,
  .glass-panel > div[style*="display:flex"]:first-child > h3,
  .panel-header-row h2,
  .panel-header-row h3 {
    width: 100% !important;
    margin-bottom: 2px !important;
    font-size: 18px !important;
    line-height: 1.3 !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  .glass-panel > div[style*="display: flex"]:first-child > div[style*="display: flex"],
  .glass-panel > div[style*="display:flex"]:first-child > div[style*="display:flex"],
  .panel-header-row > div {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
    justify-content: flex-start !important;
    box-sizing: border-box !important;
  }

  .glass-panel > div[style*="display: flex"]:first-child .btn,
  .glass-panel > div[style*="display:flex"]:first-child .btn,
  .panel-header-row .btn {
    flex: 1 1 auto !important;
    max-width: 100% !important;
    font-size: 12px !important;
    padding: 8px 12px !important;
    justify-content: center !important;
    text-align: center !important;
    white-space: normal !important;
  }

  .item-row {
    grid-template-columns: 1fr;
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 8px;
    background: var(--bg-card);
    gap: 8px;
  }
  
  .app-header {
    flex-direction: column;
    gap: 12px;
    text-align: center;
    padding: 12px 16px;
  }
  
  .user-profile {
    width: 100%;
    justify-content: space-between;
  }
  
  .tab-content form {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .tab-bar {
    gap: 4px;
  }

  .tab-btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  /* Customer, Cabang, Laporan Kunjungan tables for mobile */
  #panel-master-customers .custom-table,
  #panel-master-branches .custom-table,
  #panel-reports .custom-table {
    font-size: 11px;
  }

  /* Stack grid and flex rows in forms and buttons on mobile */
  .tab-content form div[style*="grid-template-columns: 1fr 1fr"],
  .tab-content form div[style*="grid-template-columns:1fr 1fr"],
  #giro-info-group div[style*="grid-template-columns: 1fr 1fr"],
  #giro-info-group div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .tab-content form div[style*="display: flex"],
  .tab-content form div[style*="gap: 10px"],
  .glass-panel form div[style*="display: flex"],
  .glass-panel form div[style*="gap: 10px"],
  #customer-receivables-panel div[style*="display: flex"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .tab-content form div[style*="display: flex"] button,
  .tab-content form div[style*="display: flex"] .btn,
  .glass-panel form div[style*="display: flex"] button,
  .glass-panel form div[style*="display: flex"] .btn,
  #customer-receivables-panel div[style*="display: flex"] button,
  #customer-receivables-panel div[style*="display: flex"] .btn {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .item-row > * {
    grid-column: auto !important;
  }
}

@media(max-width: 480px) {
  /* Small mobile device layout optimizations */
  .info-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .modal-card {
    padding: 20px 15px;
  }
}

/* Blinking badge for new/unprocessed orders/payments */
.badge-blink {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  background-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  animation: blink-animation 1.2s infinite alternate;
}

@keyframes blink-animation {
  from {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 2px rgba(239, 68, 68, 0.3);
  }
  to {
    opacity: 0.6;
    transform: scale(0.96);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
  }
}

.badge-processed {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  background-color: rgba(234, 179, 8, 0.15);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.process-checkbox {
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: #eab308;
}

/* Performance Grid for Dashboard */
.performance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .performance-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Make native calendar picker icon white and popup dark in dark theme */
input[type="date"] {
  color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) !important;
  cursor: pointer;
}

@media (max-width: 992px) {
  /* Transform tables to cards on tablet and mobile screen */
  .table-container {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 16px !important;
    box-sizing: border-box !important;
  }

  .custom-table,
  .custom-table thead,
  .custom-table tbody,
  .custom-table tr,
  .custom-table td {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .custom-table thead {
    display: none !important; /* Hide header rows on small screens */
  }

  .custom-table tr {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 14px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 14px !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  .custom-table td {
    border-bottom: 1px solid var(--border-color);
    padding: 8px 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
    font-size: 12.5px !important;
    gap: 4px !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    word-wrap: break-word !important;
    hyphens: auto !important;
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  .custom-table td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  /* Add label on top of the card row */
  .custom-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    text-align: left;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    display: block;
    width: 100% !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    min-width: unset !important;
    flex-shrink: unset !important;
  }

  /* Action buttons container formatting */
  .action-buttons-cell {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    justify-content: flex-start !important;
    width: 100% !important;
    margin-top: 4px !important;
    box-sizing: border-box !important;
  }

  .action-buttons-cell .btn {
    flex: 1 1 auto !important;
    font-size: 11px !important;
    padding: 6px 12px !important;
    justify-content: center !important;
    text-align: center !important;
    max-width: 100% !important;
    white-space: normal !important;
  }

  /* Adjust spacing in filter form for visit reports on tablet/mobile */
  #panel-reports #form-report-filter {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  
  #panel-reports #form-report-filter div {
    width: 100%;
  }

  /* PRODUCT FLASH CARDS GRID STYLING */
  #panel-master-products .table-container {
    overflow-x: visible !important;
  }

  #panel-master-products .custom-table tbody {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    width: 100%;
    margin-top: 10px;
  }

  #panel-master-products .custom-table tr {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px 20px 20px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    position: relative;
    overflow: hidden;
    margin-bottom: 0 !important;
  }

  /* Top accent color bar for product card */
  #panel-master-products .custom-table tr::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
  }

  #panel-master-products .custom-table td {
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
    font-size: 13px;
    gap: 15px;
  }

  #panel-master-products .custom-table td:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-top: auto;
    padding-top: 15px;
  }

  #panel-master-products .custom-table td::before {
    min-width: 100px;
  }
}

/* ==========================================================================
   LAPORAN KUNJUNGAN & ABSENSI STYLING (9 COLUMNS NEAT LAYOUT)
   ========================================================================== */

#panel-reports .table-container {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
  overflow-x: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  margin-top: 15px;
}

#panel-reports .custom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px !important;
}

#panel-reports .custom-table th,
#panel-reports .custom-table td {
  vertical-align: top;
  padding: 8px 10px !important;
  line-height: 1.4 !important;
}

#panel-reports .custom-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10px !important;
  letter-spacing: 0.75px;
  border-bottom: 2px solid var(--border-color);
}

/* Specific column widths for desktop view */
@media (min-width: 1025px) {
  #panel-reports .custom-table th:nth-child(1),
  #panel-reports .custom-table td:nth-child(1) { width: 100px; min-width: 100px; } /* Kegiatan */
  #panel-reports .custom-table th:nth-child(2),
  #panel-reports .custom-table td:nth-child(2) { width: 90px; min-width: 90px; } /* No. Ref */
  #panel-reports .custom-table th:nth-child(3),
  #panel-reports .custom-table td:nth-child(3) { width: 120px; min-width: 120px; } /* Tanggal */
  #panel-reports .custom-table th:nth-child(4),
  #panel-reports .custom-table td:nth-child(4) { width: 110px; min-width: 110px; } /* Karyawan */
  #panel-reports .custom-table th:nth-child(5),
  #panel-reports .custom-table td:nth-child(5) { width: 130px; min-width: 130px; } /* Customer */
  #panel-reports .custom-table th:nth-child(6),
  #panel-reports .custom-table td:nth-child(6) { width: 95px; min-width: 95px; } /* Nominal */
  #panel-reports .custom-table th:nth-child(7),
  #panel-reports .custom-table td:nth-child(7) { width: 90px; min-width: 90px; } /* Status */
  #panel-reports .custom-table th:nth-child(8),
  #panel-reports .custom-table td:nth-child(8) { min-width: 250px; width: 250px; } /* Geotagging Customer */
  #panel-reports .custom-table th:nth-child(9),
  #panel-reports .custom-table td:nth-child(9) { min-width: 280px; width: 280px; } /* Laporan Kehadiran */
}

/* Geotagging Customer Cell layout */
.geotagging-customer-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
}

.geotagging-address {
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.4;
}

.geotagging-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Laporan Kehadiran Log layout */
.attendance-log-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
}

.attendance-log-item {
  position: relative;
  padding-left: 14px;
  line-height: 1.4;
}

.attendance-log-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.attendance-log-item.check-in::before {
  background-color: var(--primary);
}

.attendance-log-item.check-out::before {
  background-color: #ef4444;
}

.attendance-log-item.active::before {
  background-color: #f59e0b;
}

.attendance-duration {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
  background: rgba(100, 116, 139, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  width: fit-content;
  display: inline-flex;
  align-items: center;
}

.attendance-notes-badge {
  background: #f1f5f9;
  border-left: 3px solid #cbd5e1;
  padding: 4px 8px;
  border-radius: 0 6px 6px 0;
  font-style: italic;
  color: #334155;
  font-size: 11px;
  line-height: 1.4;
  margin-top: 1px;
}

/* Full face layout for laptop/desktop screen on reports and dashboard page */
@media (min-width: 993px) {
  body[data-page="reports"] .main-content,
  body[data-page="dashboard"] .main-content {
    max-width: 98% !important;
    width: 98% !important;
    padding-left: 15px;
    padding-right: 15px;
  }
}

/* --- PWA Install Banner --- */
#pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1500;
  padding: 0 16px 16px;
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
  pointer-events: none;
}

#pwa-install-banner.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.pwa-install-content {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: #1a4ba9;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(255,255,255,0.1) inset;
  color: #ffffff;
}

.pwa-install-icon {
  font-size: 28px;
  flex-shrink: 0;
  line-height: 1;
}

.pwa-install-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pwa-install-text strong {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.pwa-install-text span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

.pwa-install-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.pwa-install-actions .btn-primary {
  background: #ffffff;
  color: #1a4ba9;
  font-weight: 700;
  font-size: 12px;
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
}

.pwa-install-actions .btn-primary:hover {
  background: #e2e8f0;
}

.pwa-install-actions .btn-outline {
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 8px;
}

.pwa-install-actions .btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

@media (max-width: 400px) {
  .pwa-install-content {
    flex-wrap: wrap;
    gap: 12px;
  }
  .pwa-install-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* --- GPS BLOCKING OVERLAY --- */
#gps-blocking-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.85); /* Sleek slate dark background */
  backdrop-filter: blur(12px); /* Glassmorphism blur */
  -webkit-backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
  opacity: 1;
  transition: opacity 0.3s ease;
}

#gps-blocking-overlay.gps-overlay-hidden {
  opacity: 0;
  pointer-events: none;
  display: none !important;
}

.gps-card {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 20px;
  max-width: 440px;
  width: 100%;
  padding: 32px 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
  animation: gpsCardEntrance 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes gpsCardEntrance {
  from {
    transform: translateY(20px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.gps-icon {
  font-size: 54px;
  margin-bottom: 16px;
  display: inline-block;
  animation: pulseGps 2s infinite;
}

@keyframes pulseGps {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.gps-card h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-color, #0f172a);
  margin: 0 0 10px 0;
}

.gps-card p {
  font-size: 14px;
  color: var(--text-muted, #64748b);
  line-height: 1.5;
  margin: 0 0 24px 0;
}

.instructions-box {
  background: var(--bg-body, #f8fafc);
  border: 1px dashed var(--border-color, #cbd5e1);
  border-radius: 12px;
  padding: 16px;
  text-align: left;
  margin-bottom: 24px;
}

.instructions-box h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-color, #0f172a);
  margin: 0 0 10px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.instructions-box p {
  font-size: 12px;
  color: var(--text-muted, #475569);
  line-height: 1.6;
  margin: 0 0 8px 0;
}

.instructions-box p:last-child {
  margin-bottom: 0;
}

.gps-card .btn-primary {
  width: 100%;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  transition: all 0.2s ease;
}

.gps-card .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.gps-card .btn-primary:active {
  transform: translateY(0);
}

/* --- CUSTOMER PAGE & TABLE DESIGN OPTIMIZATIONS (SUPER ADMIN VIEW) --- */

/* 1. Make main content wider for pages with large tables */
body[data-page="customers"] .main-content,
body[data-page="users"] .main-content,
body[data-page="branches"] .main-content,
body[data-page="reports"] .main-content {
  max-width: 95% !important;
}

/* 2. Fix for Alamat (Address) column wrapping too aggressively on desktop/tablet */
.custom-table td[data-label="Alamat"] {
  min-width: 280px; /* Ensure address has enough horizontal space */
  max-width: 400px;
  white-space: normal !important;
  word-break: break-word !important;
}

/* 3. Align action buttons cell nicely on desktop */
.action-buttons-cell {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* --- SEARCHABLE SELECT & OVERLAY STYLING --- */
.searchable-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: 8px;
  min-height: 42px;
  font-size: 14px;
  color: var(--text-main);
  transition: border-color var(--transition-speed);
}
.searchable-select-trigger:after {
  content: '▼';
  font-size: 10px;
  color: var(--text-muted);
}
.searchable-select-trigger.disabled {
  background-color: rgba(0, 0, 0, 0.05);
  cursor: not-allowed;
  pointer-events: none;
}

/* Search Modal styles */
.search-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
  padding: 16px;
}
.search-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.search-modal-card {
  width: 100%;
  max-width: 500px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  margin-top: 5vh;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.search-modal-header {
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 10px;
  align-items: center;
}
.search-modal-input {
  flex: 1;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: #ffffff !important;
}
.search-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
}
.search-modal-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}
.search-modal-item {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  color: #ffffff !important;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.15s;
}
.search-modal-item:hover, .search-modal-item.selected {
  background: rgba(37, 99, 235, 0.25);
  color: #60a5fa !important;
}
.search-modal-no-results {
  padding: 20px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}


