:root {
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Color Palette - Dark Theme Default */
  --bg-base: #0a0d14;
  --bg-surface: #121722;
  --bg-surface-elevated: #1a202e;
  --bg-card: rgba(22, 28, 41, 0.7);
  --bg-card-hover: rgba(28, 36, 52, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  --primary-light: rgba(99, 102, 241, 0.12);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --success-light: rgba(16, 185, 129, 0.12);
  
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.2);
  --warning-light: rgba(245, 158, 11, 0.12);
  
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.12);
  
  --info: #06b6d4;
  --info-light: rgba(6, 182, 212, 0.12);
  
  --wa-color: #25d366;
  --wa-hover: #1ebd5b;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --glass-blur: blur(16px);
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
}

body.light-theme {
  --bg-base: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: #ffffff;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(99, 102, 241, 0.6);
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #94a3b8;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-base);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(16, 185, 129, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* Glass panel utility */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

/* Auth / Login View */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--info), var(--success));
}

.auth-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.brand-icon {
  width: 60px;
  height: 60px;
  background: var(--primary-light);
  border: 1px solid var(--border-focus);
  color: var(--primary);
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.auth-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth-title span {
  color: var(--primary);
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.auth-form .form-group {
  margin-bottom: 1.25rem;
}

/* Layout */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.75rem;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-badge {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), #4338ca);
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.brand-text-wrap {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}

.brand-name strong {
  color: var(--primary);
}

.brand-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.period-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.select-clean {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.2rem;
  outline: none;
}

.select-clean option {
  background-color: var(--bg-surface);
  color: var(--text-main);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem 0.35rem 0.35rem;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
}

.avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
}

/* Main Container */
.main-container {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  padding: 1.25rem 1.5rem;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.card-glow-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--primary);
}

.card-glow-success::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--success);
}

.card-glow-warning::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--warning);
}

.card-glow-info::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--info);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-wrap.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon-wrap.success { background: var(--success-light); color: var(--success); }
.stat-icon-wrap.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon-wrap.info { background: var(--info-light); color: var(--info); }

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.stat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-subtle);
}

.progress-bar-wrap {
  flex: 1;
  max-width: 120px;
  height: 6px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--success);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* Customers Section */
.customers-section {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.section-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.toolbar-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.filter-tabs {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 3px;
}

.filter-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-tab:hover {
  color: var(--text-main);
}

.filter-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  width: 260px;
  transition: border-color var(--transition-fast);
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  width: 100%;
}

.clear-btn {
  background: none;
  border: none;
  color: var(--text-subtle);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}

/* Customer Grid */
.customer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.customer-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: all var(--transition-fast);
}

.customer-card:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.customer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.cust-name-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.cust-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.cust-info h4 {
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.2;
}

.cust-phone {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cust-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.detail-item .label {
  color: var(--text-subtle);
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.detail-item .val {
  font-weight: 600;
}

.cust-address {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.cust-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-surface-elevated);
}

.btn-success {
  background: var(--wa-color);
  color: #fff;
}

.btn-success:hover {
  background: var(--wa-hover);
}

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--border-focus);
}

.btn-outline-primary:hover {
  background: var(--primary-light);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  border-radius: 6px;
}

.btn-block {
  width: 100%;
}

.btn-icon-only {
  padding: 0.5rem;
}

.icon-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  color: var(--text-main);
  border-color: var(--border-focus);
}

.icon-btn.danger:hover {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--text-subtle);
  pointer-events: none;
}

.input-icon-wrap input {
  padding-left: 2.5rem;
}

input[type="text"],
input[type="password"],
input[type="tel"],
input[type="number"],
textarea {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition-fast);
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-action-wrap {
  display: flex;
  gap: 0.5rem;
}

.textarea-clean {
  resize: vertical;
  line-height: 1.5;
}

/* Modals with HTML5 dialog */
dialog.modal-dialog {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 520px;
  width: 90vw;
  margin: auto;
  box-shadow: var(--shadow-lg);
  color: var(--text-main);
}

dialog.modal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.wa-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(37, 211, 102, 0.15);
  color: var(--wa-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-modal-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-subtle);
  cursor: pointer;
  line-height: 1;
}

.close-modal-btn:hover {
  color: var(--text-main);
}

.modal-form,
.modal-body {
  padding: 1.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-grid .full-width {
  grid-column: span 2;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.wa-target-info {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.wa-target-info strong {
  color: var(--text-main);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1000;
}

.toast {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: slideIn 0.25s ease;
  max-width: 360px;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--info); }

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

/* Loading & Empty States */
.loading-state,
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-icon {
  margin-bottom: 0.75rem;
  color: var(--text-subtle);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.hidden {
  display: none !important;
}

/* Nav Menu Bar */
.nav-menu-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px;
}

.nav-menu-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-menu-item:hover {
  color: var(--text-main);
}

.nav-menu-item.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Page Views */
.view-page {
  display: none;
  animation: fadeIn 0.2s ease;
}

.view-page.active {
  display: block;
}

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

.section-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Dashboard Quick Grid */
.dashboard-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.quick-card {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
}

.quick-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.quick-card-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.quick-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.quick-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.quick-item:hover {
  background: var(--bg-surface-elevated);
}

.quick-item-info strong {
  display: block;
  font-size: 0.9rem;
}

.quick-item-info small {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.quick-item-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.quick-amount {
  font-weight: 700;
  font-size: 0.9rem;
}

.quick-amount.danger { color: var(--danger); }
.quick-amount.success { color: var(--success); }

/* History Section */
.history-section {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.hist-filter-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.hist-filter-tab:hover {
  color: var(--text-main);
}

.hist-filter-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.history-stats-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.hist-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hist-stat-item .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-subtle);
  font-weight: 700;
}

.hist-stat-item strong {
  font-size: 1.3rem;
  font-weight: 800;
}

.hist-stat-item.success strong { color: var(--success); }
.hist-stat-item.warning strong { color: var(--warning); }

.hist-stat-item small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Data Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.data-table thead {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  padding: 0.85rem 1rem;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

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

/* Customer History Modal Summary */
.cust-history-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.summary-box {
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.summary-box .sub {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-subtle);
  font-weight: 700;
  margin-bottom: 4px;
}

.summary-box strong {
  font-size: 1.25rem;
  font-weight: 800;
}

.summary-box small {
  font-size: 0.75rem;
  margin-top: 4px;
}

.summary-box.success {
  border-left: 4px solid var(--success);
}

.summary-box.success strong {
  color: var(--success);
}

.summary-box.warning {
  border-left: 4px solid var(--warning);
}

.summary-box.warning strong {
  color: var(--warning);
}

/* Customer Detail Modal (Photo & Maps) Styles */
.detail-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.detail-info-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-info-card .info-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.detail-info-card .info-value {
  font-size: 0.95rem;
  color: var(--text-main);
  font-weight: 600;
}

.info-value-row {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.detail-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.detail-section-block {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  margin-top: 1rem;
}

.detail-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.section-title-icon {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
}

.section-title-icon h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.detail-photo-wrapper {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-surface);
}

.detail-photo-card {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.detail-customer-img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base);
}

.detail-photo-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem 1rem;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.detail-photo-empty {
  padding: 2.25rem 1.5rem;
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--text-muted);
}

.detail-map-wrapper {
  width: 100%;
  height: 250px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.map-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.map-empty-state {
  height: 100%;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.75rem;
  padding: 1.5rem;
  color: var(--text-muted);
}

.detail-map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.85rem;
}

.btn-xs {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.coord-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--border-focus);
  font-family: monospace;
}

.cust-avatar.has-photo {
  background-size: cover;
  background-position: center;
  border: 2px solid var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

.customer-top {
  cursor: pointer;
}

/* Payment Recap (Tunai vs Transfer) */
.payment-recap-banner {
  margin-top: 1.25rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

.recap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.recap-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.recap-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.recap-method-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.recap-method-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

.recap-method-card.cash {
  border-left: 4px solid var(--success);
}

.recap-method-card.transfer {
  border-left: 4px solid var(--primary);
}

.method-icon-badge {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.method-icon-badge.cash {
  background: var(--success-light);
  color: var(--success);
}

.method-icon-badge.transfer {
  background: var(--primary-light);
  color: var(--primary);
}

.method-info {
  display: flex;
  flex-direction: column;
}

.method-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.method-amount {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  margin: 0.2rem 0;
}

.recap-method-card.cash .method-amount {
  color: var(--success);
}

.recap-method-card.transfer .method-amount {
  color: var(--primary);
}

.method-count {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

/* History Stats Items for Cash & Transfer */
.hist-stat-item.cash strong {
  color: var(--success);
}

.hist-stat-item.transfer strong {
  color: var(--primary);
}

/* Payment Modal Styles */
.pay-target-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.15rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.pay-target-summary .sub-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
}

.payment-method-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.method-option {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  transition: all var(--transition-fast);
  position: relative;
}

.method-option:hover {
  border-color: rgba(99, 102, 241, 0.4);
  background: var(--bg-surface-elevated);
}

.method-option.active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 12px var(--primary-glow);
}

.method-icon-box {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.method-icon-box.cash {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.method-icon-box.transfer {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
}

.method-text-wrap {
  display: flex;
  flex-direction: column;
}

.method-text-wrap strong {
  font-size: 0.88rem;
  color: var(--text-main);
}

.method-text-wrap small {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.check-pill {
  margin-left: auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all var(--transition-fast);
}

.method-option.active .check-pill {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

/* Badges for Method in Tables and Cards */
.badge-method-tunai {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
}

.badge-method-transfer {
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.25);
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  .navbar {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  
  .period-controls {
    order: 3;
    width: 100%;
    justify-content: center;
  }
  
  .period-picker {
    width: 100%;
    justify-content: center;
  }
  
  .main-container {
    padding: 1rem;
  }
  
  .section-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .toolbar-left,
  .toolbar-right {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-box {
    width: 100%;
  }
  
  .filter-tabs {
    overflow-x: auto;
  }
  
  .customer-grid {
    grid-template-columns: 1fr;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .form-grid .full-width {
    grid-column: span 1;
  }
}
