/* ============================================================
   QWM - Qurban Warga Makassar | Main Stylesheet
   Mobile-first, PWA-ready, Material-inspired
   ============================================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ============================================================
   CSS Variables
   ============================================================ */
:root {
  --primary:       #1a5c38;
  --primary-light: #2e7d52;
  --primary-dark:  #0d3b24;
  --primary-50:    #e8f5e9;
  --secondary:     #c8922a;
  --secondary-light: #f0b941;
  --secondary-dark:  #9a6f1e;
  --accent:        #fff8e1;
  --danger:        #c62828;
  --danger-light:  #ffebee;
  --warning:       #e65100;
  --warning-light: #fff3e0;
  --success:       #2e7d32;
  --success-light: #e8f5e9;
  --info:          #0277bd;
  --info-light:    #e1f5fe;
  --text:          #1c1c1c;
  --text-muted:    #6b7280;
  --text-light:    #9ca3af;
  --border:        #e5e7eb;
  --border-dark:   #d1d5db;
  --bg:            #f4f6f8;
  --bg-card:       #ffffff;
  --white:         #ffffff;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
  --shadow:        0 2px 12px rgba(0,0,0,.1);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.15);
  --radius-sm:     8px;
  --radius:        12px;
  --radius-lg:     16px;
  --radius-full:   9999px;
  --sidebar-w:     260px;
  --topbar-h:      60px;
  --bottomnav-h:   64px;
  --transition:    all .2s ease;
  --font:          'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
  max-width: 100%;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ============================================================
   App Shell Layout
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100dvh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100%;
  background: var(--primary-dark);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  min-height: var(--topbar-h);
}

.sidebar-logo {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--secondary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: white;
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-size: 13px; font-weight: 600;
  color: white;
  line-height: 1.3;
}

.sidebar-brand-sub { font-size: 10px; color: rgba(255,255,255,.5); }

.sidebar-section {
  padding: 12px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,.35);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.sidebar-nav { flex: 1; padding: 8px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: rgba(255,255,255,.75);
  font-size: 13.5px;
  font-weight: 400;
  border-radius: var(--radius-sm);
  margin: 1px 8px;
  transition: var(--transition);
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: white;
}

.nav-item.active {
  background: var(--secondary);
  color: white;
  font-weight: 600;
}

.nav-item .nav-icon {
  font-size: 20px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.sidebar-user {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--secondary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,.5); }

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
  backdrop-filter: blur(2px);
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-toggle {
  display: none;
  width: 38px; height: 38px;
  border: none; background: none;
  border-radius: var(--radius-sm);
  align-items: center; justify-content: center;
  color: var(--text);
  font-size: 22px;
}

.topbar-title { font-size: 16px; font-weight: 600; flex: 1; }
.topbar-subtitle { font-size: 12px; color: var(--text-muted); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.topbar-btn {
  width: 38px; height: 38px;
  border: none; background: none;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 22px;
  transition: var(--transition);
  position: relative;
}

.topbar-btn:hover { background: var(--bg); color: var(--primary); }

/* Page content */
.page-content {
  flex: 1;
  padding: 24px 20px;
  max-width: 1200px;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title { font-size: 20px; font-weight: 700; color: var(--text); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* Bottom Navigation (mobile) */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h);
  background: white;
  border-top: 1px solid var(--border);
  z-index: 200;
  padding: 0 8px;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  min-width: 56px;
  transition: var(--transition);
}

.bottom-nav-item .material-icons { font-size: 22px; }

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item.active .material-icons {
  font-weight: 600;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
}

.stat-card.green::before  { background: var(--primary); }
.stat-card.gold::before   { background: var(--secondary); }
.stat-card.blue::before   { background: var(--info); }
.stat-card.red::before    { background: var(--danger); }
.stat-card.orange::before { background: var(--warning); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 12px;
}

.stat-icon.green  { background: var(--primary-50); color: var(--primary); }
.stat-icon.gold   { background: var(--accent);     color: var(--secondary-dark); }
.stat-icon.blue   { background: var(--info-light);  color: var(--info); }
.stat-icon.red    { background: var(--danger-light);color: var(--danger); }
.stat-icon.orange { background: var(--warning-light);color: var(--warning); }

.stat-value { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-change { font-size: 11px; margin-top: 6px; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* Stat card flex row variant (icon left + info right) */
.stat-info { flex: 1; min-width: 0; }
.stat-card:has(.stat-info) {
  display: flex;
  align-items: center;
  gap: 12px;
}
.stat-card:has(.stat-info) .stat-icon {
  margin-bottom: 0;
  flex-shrink: 0;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  height: 40px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn .material-icons { font-size: 18px; }

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

.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: var(--secondary-dark); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #1b5e20; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #8b1c1c; }

.btn-warning { background: var(--warning); color: white; }
.btn-info    { background: var(--info); color: white; }

.btn-outline-primary {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}
.btn-outline-primary:hover { background: var(--primary-50); }

.btn-outline-danger {
  background: transparent;
  border: 1.5px solid var(--danger);
  color: var(--danger);
}
.btn-outline-danger:hover { background: var(--danger-light); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn-sm .material-icons { font-size: 16px; }
.btn-lg { height: 48px; padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

/* FAB */
.fab {
  position: fixed;
  bottom: calc(var(--bottomnav-h) + 16px);
  right: 20px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--secondary);
  color: white;
  border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  box-shadow: var(--shadow-lg);
  z-index: 150;
  transition: var(--transition);
  text-decoration: none;
}

.fab:hover { transform: scale(1.05); background: var(--secondary-dark); }

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

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

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 10px 14px;
  height: 42px;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: white;
  transition: var(--transition);
  outline: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,92,56,.15);
}

.form-control:disabled, .form-control[readonly] {
  background: var(--bg);
  color: var(--text-muted);
  cursor: not-allowed;
}

textarea.form-control { height: auto; min-height: 90px; resize: vertical; }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
}

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

.input-group {
  display: flex;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.input-group .form-control {
  border: none;
  border-radius: 0;
  flex: 1;
}

.input-group .form-control:focus { box-shadow: none; }

.input-group-text {
  padding: 0 12px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 13px;
  display: flex; align-items: center;
  border-right: 1.5px solid var(--border-dark);
  white-space: nowrap;
}

.input-group .input-group-text:last-child {
  border-right: none;
  border-left: 1.5px solid var(--border-dark);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Radio / Checkbox */
.radio-group, .check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.radio-option, .check-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13.5px;
}

.radio-option:has(input:checked),
.check-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-50);
  color: var(--primary);
  font-weight: 500;
}

.radio-option input, .check-option input {
  accent-color: var(--primary);
  width: 16px; height: 16px;
}

/* ============================================================
   Tables
   ============================================================ */
.table-wrapper { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table thead tr {
  background: var(--bg);
}

.table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:hover { background: var(--bg); }
.table tbody tr:last-child td { border-bottom: none; }

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

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success  { background: #dcfce7; color: #166534; }
.badge-warning  { background: #fef9c3; color: #854d0e; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-info     { background: #dbeafe; color: #1e40af; }
.badge-secondary{ background: #f1f5f9; color: #475569; }
.badge-primary  { background: var(--primary-50); color: var(--primary); }
.badge-gold     { background: var(--accent); color: var(--secondary-dark); }

/* ============================================================
   Alerts / Toasts
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
}

.alert .material-icons { font-size: 20px; flex-shrink: 0; margin-top: 1px; }

.alert-success { background: var(--success-light); color: #166534; border: 1px solid #86efac; }
.alert-danger  { background: var(--danger-light);  color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fcd34d; }
.alert-info    { background: var(--info-light);    color: #1e3a5f; border: 1px solid #93c5fd; }

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 80px; right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast {
  background: white;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  animation: slideIn .3s ease;
  border: 1px solid var(--border);
}

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

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

/* ============================================================
   Modals
   ============================================================ */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 2000;
  backdrop-filter: blur(2px);
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop.show { display: flex; }

.modal {
  background: white;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 520px;
  max-height: 90dvh;
  overflow-y: auto;
  animation: slideUp .3s ease;
}

.modal-center {
  border-radius: var(--radius-lg);
  margin: 20px;
  max-height: calc(100dvh - 40px);
  animation: fadeIn .2s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  width: 32px; height: 32px;
  border: none; background: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.modal-close:hover { background: var(--bg); }

.modal-body { padding: 20px; }
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: white;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* ============================================================
   Chips / Tags
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 500;
}

/* ============================================================
   Search / Filter Bar
   ============================================================ */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrap .material-icons {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 20px;
}

.search-input-wrap .form-control { padding-left: 40px; }

/* ============================================================
   Lists (mobile-friendly)
   ============================================================ */
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--bg); }

.list-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
  flex-shrink: 0;
}

.list-content { flex: 1; min-width: 0; }
.list-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.list-meta { font-size: 11px; color: var(--text-light); }

/* ============================================================
   QR Code
   ============================================================ */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
}

.qr-wrapper {
  background: white;
  padding: 16px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  display: inline-block;
}

.kupon-card {
  background: white;
  border-radius: var(--radius);
  border: 2px solid var(--primary);
  overflow: hidden;
  width: 100%;
  max-width: 340px;
}

.kupon-header {
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  text-align: center;
}

.kupon-body {
  padding: 16px;
  display: flex;
  gap: 16px;
  align-items: center;
}

.kupon-info { flex: 1; }
.kupon-number { font-size: 24px; font-weight: 700; color: var(--primary); }
.kupon-code { font-size: 11px; color: var(--text-muted); font-family: monospace; }

/* Scan area */
.scan-area {
  border-radius: var(--radius);
  overflow: hidden;
  background: black;
  aspect-ratio: 1;
  max-width: 300px;
  margin: 0 auto;
}

/* ============================================================
   Progress Bar
   ============================================================ */
.progress {
  background: var(--bg);
  border-radius: var(--radius-full);
  height: 8px;
  overflow: hidden;
}

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

.progress-bar.gold { background: var(--secondary); }
.progress-bar.danger { background: var(--danger); }

/* ============================================================
   Timeline
   ============================================================ */
.timeline { padding: 0; list-style: none; }

.timeline-item {
  display: flex;
  gap: 16px;
  padding-bottom: 20px;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 36px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item:last-child::before { display: none; }

.timeline-dot {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  border: 2px solid var(--primary);
}

.timeline-dot.gold { background: var(--accent); color: var(--secondary-dark); border-color: var(--secondary); }
.timeline-dot.danger { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }

.timeline-content { flex: 1; }
.timeline-title { font-size: 14px; font-weight: 600; }
.timeline-text { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.timeline-date { font-size: 11px; color: var(--text-light); margin-top: 4px; }

/* ============================================================
   Landing Page
   ============================================================ */
.hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #2e7d52 100%);
  color: white;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.hero-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}

.hero-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  gap: 20px;
}

.hero-logo {
  width: 90px; height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 42px;
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255,255,255,.3);
}

.hero-title { font-size: 28px; font-weight: 700; line-height: 1.2; }
.hero-subtitle { font-size: 15px; opacity: .8; line-height: 1.5; }
.hero-year { font-size: 13px; opacity: .6; }

.hero-badges { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.hero-badge {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,.15);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,.2);
}

.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.section { padding: 40px 20px; }
.section-title { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 8px; }
.section-subtitle { font-size: 14px; color: var(--text-muted); text-align: center; margin-bottom: 28px; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.info-card {
  background: white;
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.info-card .material-icons { font-size: 32px; color: var(--primary); margin-bottom: 8px; }
.info-card-value { font-size: 20px; font-weight: 700; color: var(--primary); }
.info-card-label { font-size: 12px; color: var(--text-muted); }

.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gallery-item { aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); position: relative; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-item-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.4);
  color: white; font-size: 36px;
}

/* Auth pages */
.auth-page {
  min-height: 100dvh;
  background: linear-gradient(160deg, var(--primary-dark), var(--primary));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px 16px;
}

.auth-card {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 400px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  margin-top: 20px;
}

.auth-header {
  background: var(--primary);
  color: white;
  padding: 28px 24px;
  text-align: center;
}

.auth-logo {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  margin: 0 auto 12px;
  border: 2px solid rgba(255,255,255,.3);
}

.auth-title { font-size: 20px; font-weight: 700; }
.auth-subtitle { font-size: 13px; opacity: .8; margin-top: 4px; }

.auth-body { padding: 24px; }
.auth-footer { padding: 16px 24px; background: var(--bg); text-align: center; font-size: 13px; color: var(--text-muted); }

/* ============================================================
   Print Styles
   ============================================================ */
@media print {
  .sidebar, .topbar, .bottom-nav, .fab,
  .btn-print, .no-print { display: none !important; }

  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  body { background: white; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }

  .kupon-print-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
}

/* ============================================================
   Responsive — Tablet (≥768px)
   ============================================================ */
@media (min-width: 768px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .info-grid { grid-template-columns: repeat(4, 1fr); }
  .form-row { grid-template-columns: 1fr 1fr; }
  .gallery-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================================
   Responsive — Mobile (≤768px)
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }

  .main-content { margin-left: 0; overflow-x: hidden; }

  .topbar-toggle { display: flex; }
  .bottom-nav { display: flex; }

  .page-content {
    padding: 14px 12px;
    padding-bottom: calc(var(--bottomnav-h) + 16px);
    overflow-x: hidden;
  }

  .fab { bottom: calc(var(--bottomnav-h) + 16px); }

  .stats-grid { grid-template-columns: 1fr 1fr; }

  /* page-header: stack vertically on mobile */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-header > div:last-child { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
  .page-header > .btn { width: 100%; justify-content: center; }
  .page-header > div:last-child > .btn,
  .page-header > div:last-child > a { flex: 1; min-width: 120px; justify-content: center; }

  .form-row { grid-template-columns: 1fr !important; }

  .modal { max-width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

  /* padding desktop-table di atas sudah di-override oleh card-table mobile */

  .hero-title { font-size: 22px; }

  /* Card header on mobile: allow wrap */
  .card-header { flex-wrap: wrap; gap: 8px; }
  .card-footer { flex-wrap: wrap; gap: 8px; }

  /* Search bar: always full width input on mobile */
  .search-bar { flex-wrap: wrap; }
  .search-bar .search-input-wrap { min-width: 100%; }
  .search-bar select.form-control { flex: 1; }

  /* Toast: full-width on mobile */
  .toast-container { left: 16px; right: 16px; max-width: 100%; }

  /* Inline 3/4-column grids: collapse to 2 columns on mobile */
  [style*="grid-template-columns: repeat(3, 1fr)"],
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns:repeat(4,1fr)"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Named responsive classes */
  .grid-mobile-1 { grid-template-columns: 1fr !important; }
  .grid-mobile-2 { grid-template-columns: 1fr 1fr !important; }

  /* Scan page: stack camera + info vertically */
  .scan-grid { grid-template-columns: 1fr !important; }
  .scan-area { max-width: 100% !important; }

  /* Form page two-panel layout: stack vertically */
  .form-kupon-grid { grid-template-columns: 1fr !important; }

  /* Grid-span elements: reset to span 1 on mobile */
  [style*="grid-column: span 2"],
  [style*="grid-column:span 2"] {
    grid-column: span 1 !important;
  }

  /* ── Mobile Card Table ─────────────────────────────────── */
  /* Tabel berubah jadi kartu per baris — tidak perlu geser kiri/kanan */
  .table-wrapper {
    overflow-x: visible;
  }

  table.table {
    display: block;
  }

  table.table thead {
    display: none; /* header disembunyikan, label muncul via data-label */
  }

  table.table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  table.table tbody tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
  }

  table.table tbody tr:hover {
    background: var(--surface);
  }

  table.table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    border-right: none;
    font-size: 13px;
    min-height: 38px;
  }

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

  /* Label dari data-label */
  table.table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    flex-shrink: 0;
    min-width: 90px;
    max-width: 40%;
    padding-top: 2px;
    line-height: 1.4;
  }

  /* Kolom tanpa label (# atau kosong): sembunyikan pseudo, full width */
  table.table td[data-label=''] {
    justify-content: flex-end;
    font-size: 12px;
    color: var(--text-muted);
    padding: 6px 14px;
    min-height: 0;
  }
  table.table td[data-label='']::before {
    display: none;
  }

  /* Kolom Aksi: tombol sejajar, full width */
  table.table td.td-actions {
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--bg);
    border-top: 1px dashed var(--border);
    border-bottom: none;
  }
  table.table td.td-actions::before {
    display: none;
  }
  table.table td.td-actions .table-actions {
    flex-wrap: wrap;
  }

  /* Tabel di PDF / laporan: tetap horizontal */
  .print-only table,
  .pdf-table { display: table !important; }
  .pdf-table thead { display: table-header-group !important; }
  .pdf-table tbody { display: table-row-group !important; }
  .pdf-table tr { display: table-row !important; }
  .pdf-table td, .pdf-table th { display: table-cell !important; }

  /* Topbar: limit title length */
  .topbar-title { font-size: 14px; }

  /* Stat card: ensure numbers fit */
  .stat-value { font-size: 18px; }
  .stat-card { padding: 14px; }

  /* Bottom nav: larger touch targets */
  .bottom-nav-item { padding: 4px 8px; min-width: 44px; }

  /* Buttons in card footers full width on small screens */
  .card-footer { justify-content: flex-end; }
}

/* ============================================================
   Utilities
   ============================================================ */
.d-flex { display: flex; }
.d-grid { display: grid; }
.d-block { display: block; }
.d-none { display: none; }

.align-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-primary{ color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.text-warning{ color: var(--warning); }

.font-weight-600 { font-weight: 600; }
.font-weight-700 { font-weight: 700; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-16 { font-size: 16px; }

.mt-1{margin-top:4px} .mt-2{margin-top:8px} .mt-3{margin-top:12px} .mt-4{margin-top:16px} .mt-5{margin-top:24px}
.mb-1{margin-bottom:4px} .mb-2{margin-bottom:8px} .mb-3{margin-bottom:12px} .mb-4{margin-bottom:16px} .mb-5{margin-bottom:24px}

.p-0{padding:0} .p-2{padding:8px} .p-3{padding:12px} .p-4{padding:16px}

.w-100 { width: 100%; }
.rounded { border-radius: var(--radius-sm); }
.rounded-full { border-radius: var(--radius-full); }

.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state .material-icons { font-size: 56px; color: var(--border-dark); margin-bottom: 12px; }
.empty-state-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.empty-state-text { font-size: 13px; }

/* PWA Install Banner */
.pwa-banner {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--primary-dark);
  color: white;
  padding: 14px 16px;
  z-index: 10000;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  box-shadow: 0 -4px 20px rgba(0,0,0,.2);
}

.pwa-banner.show { display: flex; }
.pwa-banner-text { flex: 1; font-size: 13px; }
.pwa-banner-title { font-weight: 600; }
.pwa-banner-sub { font-size: 12px; opacity: .75; }

/* Loading spinner */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

/* Floating label input */
.float-group { position: relative; }

.float-group .form-control {
  padding-top: 20px;
  padding-bottom: 6px;
  height: 50px;
}

.float-group label {
  position: absolute;
  top: 16px; left: 14px;
  font-size: 14px;
  color: var(--text-muted);
  transition: var(--transition);
  pointer-events: none;
}

.float-group .form-control:focus ~ label,
.float-group .form-control:not(:placeholder-shown) ~ label {
  top: 6px;
  font-size: 11px;
  color: var(--primary);
}

/* Number input with arrows hidden */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ============================================================
   Stat card flex variant (icon + info side by side)
   ============================================================ */
.stat-card.flex-row,
.stat-card[style*="display:flex"],
.stat-card[style*="display: flex"] {
  display: flex !important;
  align-items: center;
  gap: 12px;
}

/* ============================================================
   Responsive Grid Utility Classes
   ============================================================ */
.grid-2cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3cols { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.grid-4cols { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }

@media (max-width: 768px) {
  /* 2-col grid: collapse to single column */
  .grid-2cols { grid-template-columns: 1fr; }
  /* 3-col grid: collapse to 2 columns */
  .grid-3cols { grid-template-columns: 1fr 1fr; }
  /* 4-col grid: collapse to 2 columns */
  .grid-4cols { grid-template-columns: 1fr 1fr; }

  .card-body { padding: 16px; }
  .card-header { padding: 14px 16px; }
  .card-footer { padding: 10px 16px; }
}

@media (max-width: 480px) {
  /* On very small screens: everything 1 col */
  .grid-2cols, .grid-3cols, .grid-4cols { grid-template-columns: 1fr; }
  .page-title { font-size: 17px; }
  .stat-value { font-size: 16px; }
}

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 16px;
  justify-content: center;
}

.page-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--primary);
  background: white;
  border: 1px solid var(--border);
  transition: var(--transition);
}

.page-item:hover { background: var(--primary-50); border-color: var(--primary); }
.page-item.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ── Sembunyikan pagination di HP — semua data terurai panjang ── */
@media (max-width: 768px) {
  .pagination { display: none !important; }
}
