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

body {
  overflow-x: hidden;
  overscroll-behavior-y: none;
  max-width: 100%;
}

:root {
  --primary: #1e293b;
  --primary-light: #334155;
  --primary-hover: #0f172a;
  --accent: #3b82f6;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.page { display: none; }
.page.active { display: block; }

/* ── LOGIN ─────────────────────────────────────────── */
.login-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #0f172a;
}
.login-card {
  width: 100%; max-width: 380px;
  background: #1a2740;
  border-radius: 18px;
  padding: 36px 28px 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  display: flex; flex-direction: column; align-items: center;
}
.login-card-header {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 28px;
}
.login-logo {
  width: 300px; height: auto; object-fit: contain;
  margin-bottom: 20px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}
.login-title { display: none; }
.login-subtitle {
  font-size: 13px; color: #94a3b8; letter-spacing: 0.3px;
}
.login-form {
  width: 100%;
  display: flex; flex-direction: column; gap: 12px;
}
.login-form input {
  width: 100%;
  padding: 13px 16px;
  background: #0f172a;
  border: 1.5px solid #2d3f5e;
  border-radius: 10px;
  font-size: 15px;
  color: #f1f5f9;
  outline: none;
  transition: border-color 0.2s;
}
.login-form input::placeholder { color: #64748b; }
.login-form input:focus { border-color: #3b82f6; }
.login-form button {
  width: 100%;
  padding: 14px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 4px;
}
.login-form button:hover { background: #1d4ed8; }
.login-copyright {
  margin-top: 22px;
  font-size: 11px;
  color: #475569;
  letter-spacing: 0.3px;
}
.error-msg { color: var(--danger); font-size: 13px; text-align: center; min-height: 18px; }

/* ── NAVBAR ─────────────────────────────────────────── */
.navbar {
  height: 60px; background: var(--primary);
  display: flex; align-items: center;
  padding: 0 20px; gap: 12px;
  position: sticky; top: 0; z-index: 300;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.navbar-brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.nav-logo { height: 30px; flex-shrink: 0; }
.nav-title { font-size: 16px; font-weight: 700; color: #f8fafc; letter-spacing: 0.3px; white-space: nowrap; }

.navbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Desktop nav menu */
#nav-menu { display: flex; gap: 2px; flex-shrink: 0; }
.nav-btn {
  padding: 6px 12px; border: none; background: transparent;
  border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500;
  color: #94a3b8; transition: background 0.15s, color 0.15s; white-space: nowrap;
}
.nav-btn:hover  { background: var(--primary-light); color: #f8fafc; }
.nav-btn.active { background: var(--primary-light); color: #fff; }

.btn-logout {
  padding: 6px 14px; border: 1px solid var(--danger);
  background: var(--danger); border-radius: 6px;
  cursor: pointer; font-size: 13px; color: #fff;
  white-space: nowrap; transition: all 0.15s;
}
.btn-logout:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

/* Hamburger button */
.btn-hamburger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 36px; height: 36px;
  background: transparent; border: 1px solid #475569;
  border-radius: 6px; cursor: pointer; padding: 0;
}
.btn-hamburger span {
  display: block; width: 18px; height: 2px;
  background: #94a3b8; border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.btn-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.btn-hamburger.open span:nth-child(2) { opacity: 0; }
.btn-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── DRAWER ─────────────────────────────────────────── */
.drawer-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 400;
  backdrop-filter: blur(2px);
}
.drawer-overlay.open { display: block; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 260px; background: var(--primary);
  z-index: 500; transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.3);
  will-change: transform;
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid #334155;
  flex-shrink: 0;
}
.drawer-logo  { height: 28px; }
.drawer-title { font-size: 15px; font-weight: 700; color: #f8fafc; flex: 1; }
.drawer-close {
  background: none; border: none; color: #64748b;
  font-size: 16px; cursor: pointer; padding: 4px; line-height: 1;
}
.drawer-close:hover { color: #f8fafc; }

.drawer-nav {
  overflow-y: auto; padding: 10px 0;
}
.drawer-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 18px;
  background: none; border: none; cursor: pointer;
  font-size: 14px; font-weight: 500; color: #94a3b8;
  text-align: left; transition: background 0.15s, color 0.15s;
}
.drawer-btn:hover  { background: #334155; color: #f8fafc; }
.drawer-btn.active { background: #334155; color: #fff; }
.drawer-btn .d-ico { flex-shrink: 0; }

.drawer-footer {
  padding: 12px 18px; border-top: 1px solid #334155; flex-shrink: 0;
}
.drawer-logout {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  background: var(--danger); border: 1px solid var(--danger);
  border-radius: 8px; cursor: pointer;
  font-size: 14px; color: #fff; transition: all 0.15s;
}
.drawer-logout:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

/* ── NAV BACK BUTTON ────────────────────────────────── */
.btn-nav-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
  color: #f1f5f9; border-radius: 7px;
  padding: 5px 12px; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background 0.15s;
  white-space: nowrap; flex-shrink: 0;
}
.btn-nav-back:hover { background: rgba(255,255,255,0.15); }

/* Hide hamburger on desktop, show nav-menu */
@media (min-width: 769px) {
  .btn-hamburger { display: none !important; }
}

/* On mobile: hide desktop menu, show hamburger */
@media (max-width: 768px) {
  #nav-menu { display: none !important; }
  .btn-logout { display: none !important; }
  .btn-hamburger { display: flex !important; }
}

/* Sales role: always show logout, never show hamburger */
#page-app.sales-role .btn-hamburger { display: none !important; }
#page-app.sales-role .btn-logout { display: flex !important; }

/* Subpage mode: hide nav-menu & hamburger (both desktop + mobile) */
#page-app[data-nav-mode="subpage"] #nav-menu { display: none !important; }
#page-app[data-nav-mode="subpage"] .btn-hamburger { display: none !important; }

/* ── MAIN ───────────────────────────────────────────── */
main { padding: 24px; max-width: 960px; margin: 0 auto; }

/* ── CARD BASE ──────────────────────────────────────── */
.card {
  background: var(--card); border-radius: 14px;
  padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  margin-bottom: 16px; border: 1px solid var(--border);
}
.card h2 {
  font-size: 16px; font-weight: 600; color: var(--text);
  margin-bottom: 16px;
}

/* ── ICON BASE ──────────────────────────────────────── */
.icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.heading-ico { margin-right: 6px; opacity: 0.75; }
.btn-ico     { margin-left: 4px; margin-right: 2px; vertical-align: middle; }

/* ── WELCOME BAR (lightweight) ──────────────────────── */
.welcome-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 16px;
  margin-bottom: 14px;
}
.welcome-bar-left { display: flex; align-items: center; gap: 8px; }
.wb-ico   { color: var(--text-muted); flex-shrink: 0; }
.wb-name  { font-size: 14px; font-weight: 600; color: var(--text); }
.wb-sep   { color: var(--border); }
.wb-date  { font-size: 13px; color: var(--text-muted); }

/* ── PRIMARY ACTION CARD ────────────────────────────── */
.module-primary {
  background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 60%, #2563eb 100%);
  border-radius: 14px; padding: 28px 24px;
  margin-bottom: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  transition: transform 0.15s, box-shadow 0.15s;
  border: none; position: relative; overflow: hidden;
}
.module-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(29,78,216,0.4); }
.module-primary .mod-info { flex: 1; }
.module-primary .mod-icon-wrap {
  display: flex; align-items: center; justify-content: center;
  width: 60px; height: 60px; background: rgba(255,255,255,0.13);
  border-radius: 14px; margin-bottom: 14px;
}
.mod-ico { color: rgba(255,255,255,0.95); }
.module-primary .mod-title { font-size: 22px; font-weight: 700; color: #fff; letter-spacing: -0.2px; }
.module-primary .mod-sub { font-size: 13px; color: rgba(255,255,255,0.6); margin-top: 5px; }
.module-primary .mod-cta {
  display: flex; align-items: center; gap: 8px;
  background: #fff; color: #1e293b;
  border: none;
  padding: 12px 22px; border-radius: 10px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  white-space: nowrap; transition: background 0.15s, box-shadow 0.15s;
  flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.module-primary .mod-cta:hover { background: #f0f9ff; box-shadow: 0 4px 14px rgba(0,0,0,0.2); }
.cta-ico { color: #1e293b; }

/* ── SECONDARY MODULE GRID ──────────────────────────── */
.module-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
.module-card {
  background: var(--card); border-radius: 14px;
  padding: 22px 20px; cursor: pointer;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  position: relative; overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.module-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.mc-watermark-icon {
  position: absolute; right: -8px; bottom: -10px;
  opacity: 0.05; pointer-events: none;
  color: var(--primary);
}
.mc-icon-wrap {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; background: #f1f5f9;
  border-radius: 10px; margin-bottom: 12px;
}
.mc-ico { color: var(--primary); }
.module-card .mc-title { font-size: 15px; font-weight: 600; color: var(--text); }
.module-card .mc-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ── HISTORY SECTION ────────────────────────────────── */
.section-title {
  font-size: 15px; font-weight: 600; color: var(--text);
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.section-title::before { content: ''; display: block; width: 4px; height: 16px; background: var(--primary); border-radius: 2px; }
.section-title .icon { color: var(--text-muted); }

/* ── FILTER BAR ─────────────────────────────────────── */
.filter-bar {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; align-items: flex-end;
}
.filter-group {
  display: flex; flex-direction: column; gap: 4px;
}
.filter-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.filter-bar input, .filter-bar select {
  padding: 8px 10px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 13px; color: var(--text);
  outline: none; background: #fff;
}
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--primary); }

/* ── STATS GRID ─────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px; margin-bottom: 16px;
}
.stat-card {
  background: var(--primary); color: #fff;
  border-radius: 10px; padding: 14px 12px;
  text-align: center;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
}
.stat-card-accent { background: var(--primary); } /* uniform color */
.stat-card .stat-icon { display: flex; align-items: center; justify-content: center; margin-bottom: 2px; }
.stat-ico { color: rgba(255,255,255,0.4); }
.stat-card .stat-num { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 1px; font-weight: 500; }

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card .stat-num { font-size: 22px; }
}

/* ── BUTTONS ────────────────────────────────────────── */
.btn { padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer; font-size: 14px; font-weight: 500; transition: opacity 0.15s; }
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); opacity: 1; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; color: var(--text-muted);
  font-size: 13px; cursor: pointer; padding: 0; margin-bottom: 16px;
  font-weight: 500;
}
.btn-back:hover { color: var(--text); }
.btn-back .icon { vertical-align: middle; }

/* Review box icons */
.review-check { display: flex; align-items: center; gap: 8px; }
.review-ico { color: var(--success); }
.review-loc { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.review-loc-ico { color: var(--text-muted); }

/* ── TABLE ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
th { background: #f8fafc; font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

/* ── DAFTAR KUNJUNGAN RESPONSIVE ────────────────────── */
/* Desktop: tampilkan tabel, sembunyikan cards */
.dk-table-wrap { overflow-x: auto; }
.dk-card-list  { display: none; }

/* Mobile: sembunyikan tabel, tampilkan cards */
@media (max-width: 768px) {
  .dk-table-wrap { display: none; }
  .dk-card-list  { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }

  .dk-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
  }

  .dk-card-header {
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .dk-card-store {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }
  .dk-card-sales {
    font-size: 12px;
    color: var(--text-muted);
  }

  .dk-card-body {
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .dk-card-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 6px;
  }
  .dk-card-row:last-child { border-bottom: none; padding-bottom: 0; }
  .dk-card-label {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
    padding-top: 1px;
    min-width: 60px;
  }
  .dk-card-value {
    color: var(--text);
    text-align: right;
    font-size: 12px;
    line-height: 1.4;
  }

  .dk-card-actions {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    background: #fafbfc;
  }
  .dk-card-actions .btn {
    flex: 1;
    min-height: 40px;
    justify-content: center;
    font-size: 13px;
  }
}

/* ── FORM ───────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 5px; font-weight: 500; }
.form-group input:not([type="color"]),
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; color: var(--text); background: #fff;
}
.form-group input:not([type="color"]):focus,
.form-group select:focus { border-color: var(--primary); }

/* Color input */
.color-input-wrapper {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border: 1.5px solid var(--border);
  border-radius: 8px; background: #fff; cursor: pointer;
}
.color-input-wrapper input[type="color"] {
  width: 36px; height: 36px; border: none;
  border-radius: 6px; padding: 0; cursor: pointer;
  background: none; outline: none; flex-shrink: 0;
}
.color-input-wrapper .color-hex { font-size: 14px; color: var(--text-muted); font-family: monospace; }

/* ── HISTORY SCROLL ─────────────────────────────────── */
.history-scroll {
  max-height: 320px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px;
}
.history-scroll::-webkit-scrollbar { width: 5px; }
.history-scroll::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 4px; }
.history-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.history-table { width: 100%; border-collapse: collapse; }
.history-table th, .history-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.history-table th { background: #f8fafc; font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; position: sticky; top: 0; z-index: 1; }
.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover td { background: #fafbfc; }
.btn-edit-row {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--text-muted); border-color: var(--border);
  white-space: nowrap;
}
.btn-edit-row:hover { color: var(--primary); border-color: var(--primary); background: #f8fafc; opacity: 1; }
.edit-ico { color: inherit; }

/* ── EDIT KUNJUNGAN ──────────────────────────────────── */
.edit-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 4px;
}
.meta-ico { color: var(--text-muted); flex-shrink: 0; }
.edit-actions {
  display: flex; gap: 10px; margin-top: 20px;
  padding-top: 16px; border-top: 1px solid var(--border);
}
.edit-actions .btn-danger { margin-left: auto; }

/* ── CHECKIN STEPS ──────────────────────────────────── */
.step { display: none; }
.step.active { display: block; }

.location-box {
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
  font-size: 14px; margin-bottom: 14px; color: var(--text);
  min-height: 56px; display: flex; align-items: center;
}
.loc-searching { display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
.loc-found     { display: flex; align-items: center; gap: 8px; }
.loc-timestamp { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.loc-error     { display: flex; align-items: center; gap: 8px; color: var(--danger); }
.loc-acc       { font-size: 12px; color: var(--text-muted); margin-left: 4px; }
.loc-ico       { flex-shrink: 0; }
.loc-found-ico { color: var(--success); }
.loc-err-ico   { color: var(--danger); }

/* Product row */
.product-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.product-row select, .product-row input {
  flex: 1; padding: 8px 10px;
  border: 1.5px solid var(--border); border-radius: 7px;
  font-size: 13px; color: var(--text); outline: none; background: #fff;
}
.product-row select:focus, .product-row input:focus { border-color: var(--primary); }
.product-row .btn-danger { flex: 0 0 auto; }

/* Review box */
.review-box {
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 10px; padding: 16px; margin-bottom: 12px;
}
.review-box .review-check { color: var(--success); font-weight: 600; margin-bottom: 8px; font-size: 14px; }

/* ── MAP ────────────────────────────────────────────── */
#map { height: 480px; border-radius: 10px; overflow: hidden; }

/* ── BADGE ──────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-active   { background: #dcfce7; color: var(--success); }
.badge-inactive { background: #fee2e2; color: var(--danger); }

/* Color swatch */
.color-swatch { display: inline-block; width: 16px; height: 16px; border-radius: 3px; border: 1px solid var(--border); vertical-align: middle; }

/* Duration */
.duration { font-size: 12px; color: var(--text-muted); }

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

/* ── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 768px) {
  main { padding: 14px; }
  .navbar { padding: 0 14px; }
}

@media (max-width: 600px) {
  .module-primary { padding: 20px 16px; }
  .module-primary .mod-title { font-size: 17px; }
  .module-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .module-card { padding: 18px 14px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar input, .filter-bar select { width: 100%; }
  .product-row { flex-wrap: wrap; }
  .edit-actions { flex-wrap: wrap; }
  .edit-actions .btn-danger { margin-left: 0; }
}

/* ── DAFTAR KUNJUNGAN ────────────────────────────────── */

/* Filter Overlay & Drawer */
.dk-filter-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 600;
  backdrop-filter: blur(2px);
}
.dk-filter-overlay.open { display: block; }

.dk-filter-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 280px; background: #0f172a; /* Dark theme */
  color: #f1f5f9;
  z-index: 700; transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.3);
  will-change: transform;
}
.dk-filter-drawer.open { transform: translateX(0); }

.dk-filter-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid #334155;
  background: #0f172a;
}
.dk-filter-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: #f8fafc;
}
.dk-filter-close {
  background: none; border: none; font-size: 18px;
  color: #94a3b8; cursor: pointer; padding: 4px; line-height: 1;
}
.dk-filter-close:hover { color: #f8fafc; }

.dk-filter-drawer-body {
  flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px;
  scrollbar-width: thin; scrollbar-color: #334155 transparent;
}
.dk-filter-drawer-footer {
  padding: 16px; border-top: 1px solid #334155;
  display: flex; flex-direction: column; gap: 10px;
  background: #0f172a;
}

.dk-sidebar-section {
  background: #1e293b; border-radius: 8px; padding: 14px; border: 1px solid #334155;
  display: flex; flex-direction: column; gap: 10px;
}
.dk-sidebar-label {
  font-size: 12px; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 0.5px;
}

.dk-page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.dk-main-full { width: 100%; }

/* Summary Cards (Daftar Kunjungan) */
.dk-summary-cards {
  display: flex; gap: 10px; align-items: center;
}
.dk-sum-card {
  background: var(--card); border: 1px solid var(--border);
  padding: 8px 16px; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 100px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dk-sum-card-accent {
  background: #f0fdf4; border-color: #bbf7d0;
}
.dk-sum-val {
  font-size: 18px; font-weight: 700; color: var(--text); line-height: 1.2;
}
.dk-sum-lbl {
  font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px;
}
.dk-sum-card-accent .dk-sum-val { color: var(--success); }
.dk-sum-card-accent .dk-sum-lbl { color: #15803d; }

/* Filter inputs */
.dk-bar-input {
  height: 38px; padding: 0 12px;
  border: 1px solid #334155; border-radius: 6px;
  font-size: 14px; color: #0f172a; outline: none;
  background: #ffffff; font-family: inherit; width: 100%;
}
.dk-bar-input:focus { border-color: var(--primary); }
.dk-date-col { display: flex; flex-direction: column; gap: 8px; }

/* Sales checkbox list */
.dk-cb-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 160px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: #334155 transparent;
}
.dk-cb-item {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; font-size: 14px; color: #e2e8f0; position: relative; user-select: none;
}
.dk-cb-item:hover { color: #f8fafc; }
.dk-cb-item input[type="checkbox"] {
  width: 15px; height: 15px; accent-color: var(--primary);
  cursor: pointer; flex-shrink: 0;
}
.dk-cb-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.dk-cb-name { font-size: 14px; color: #e2e8f0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-empty-hint { font-size: 13px; color: #94a3b8; }

/* Week toggle pills */
.dk-week-row { display: flex; gap: 6px; flex-wrap: wrap; }
.dk-week-toggle { display: flex; align-items: center; cursor: pointer; user-select: none; flex: 1; }
.dk-week-toggle input { display: none; }
.dk-week-toggle span {
  display: inline-flex; align-items: center; justify-content: center;
  height: 34px; padding: 0 12px; width: 100%;
  border-radius: 6px; font-size: 13px; font-weight: 500;
  background: #0f172a; color: #94a3b8;
  border: 1px solid #334155; transition: all 0.15s;
}
.dk-week-toggle input:checked + span {
  background: #2563eb; color: #fff; border-color: #2563eb;
}

/* Buttons */
.dk-btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 14px; width: 100%;
  background: #2563eb; color: #fff;
  border: none; border-radius: 6px;
  font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.dk-btn-primary:hover { background: #1d4ed8; }
.dk-btn-primary:disabled { opacity: 0.6; cursor: default; }
.dk-btn-outline {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 14px; width: 100%;
  background: transparent; color: #e2e8f0;
  border: 1px solid #475569; border-radius: 6px;
  font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.dk-btn-outline:hover { background: #334155; color: #f8fafc; }

/* Result card */
.dk-result-card {
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  overflow: hidden;
}
.dk-result-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.dk-result-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: var(--text);
}
.dk-result-title .icon { color: var(--text-muted); }
.dk-result-badge {
  background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
}
#dk-result { padding: 0; }

/* Desktop table */
.dk-table-wrap { overflow-x: auto; }
.dk-table-wrap table { width: 100%; border-collapse: collapse; }
.dk-table-wrap th, .dk-table-wrap td {
  padding: 11px 16px; text-align: left;
  border-bottom: 1px solid #f1f5f9; font-size: 13px;
}
.dk-table-wrap th {
  background: #f8fafc; font-weight: 600; color: var(--text-muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
}
.dk-table-wrap tr:last-child td { border-bottom: none; }
.dk-table-wrap tr:hover td { background: #fafcff; }
.dk-table-wrap .duration { font-size: 12px; color: var(--text-muted); }

/* Mobile cards */
.dk-card-list { display: none; }

.dk-card {
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  overflow: hidden;
}
.dk-card-header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid #f1f5f9;
  display: flex; flex-direction: column; gap: 2px;
}
.dk-card-store {
  font-size: 14px; font-weight: 700; color: var(--text);
  text-transform: uppercase; letter-spacing: 0.2px;
}
.dk-card-sales { font-size: 12px; color: var(--text-muted); }
.dk-card-body { padding: 8px 14px; display: flex; flex-direction: column; }
.dk-card-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; padding: 6px 0; border-bottom: 1px solid #f8fafc;
}
.dk-card-row:last-child { border-bottom: none; }
.dk-card-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.3px; flex-shrink: 0;
}
.dk-card-value { font-size: 12px; color: var(--text); text-align: right; line-height: 1.4; }
.dk-card-actions {
  display: flex; gap: 8px; padding: 10px 14px;
  border-top: 1px solid #f1f5f9; background: #fafbfc;
}
.dk-card-actions .btn {
  flex: 1; min-height: 40px; display: flex;
  align-items: center; justify-content: center;
  font-size: 13px; border-radius: 8px;
}

@media (max-width: 768px) {
  .dk-cb-list { max-height: 120px; }

  .dk-table-wrap { display: none; }
  .dk-card-list { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
}

/* Legacy (other pages) */
.cb-list { display: flex; flex-direction: column; gap: 6px; }
.cb-label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; padding: 5px 8px; border-radius: 6px; transition: background 0.1s;
}
.cb-label:hover { background: #f1f5f9; }
.cb-label input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.cb-name { font-size: 13px; color: var(--text); }
.text-muted-sm { font-size: 12px; color: var(--text-muted); }

/* ── MAP FULL SCREEN & FILTER DRAWER ────────────────── */
#page-map-fullscreen {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; flex-direction: column; z-index: 1000;
}
.map-header {
  height: 60px; background: var(--primary);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; z-index: 1010; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.map-header-left { display: flex; align-items: center; gap: 12px; }
.map-title { font-size: 16px; font-weight: 700; color: #f8fafc; letter-spacing: 0.3px; }
.btn-map-back { background: none; border: none; color: #f8fafc; cursor: pointer; display: flex; align-items: center; padding: 4px; }
.btn-map-filter { background: none; border: none; color: #f8fafc; cursor: pointer; display: flex; align-items: center; padding: 4px; }
.btn-map-filter span { display: block; width: 18px; height: 2px; background: #f8fafc; border-radius: 2px; margin: 3px 0; }

#map-container { flex: 1; position: relative; }
#map-fullscreen { position: absolute; inset: 0; }

.map-drawer-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 1020;
  backdrop-filter: blur(2px);
}
.map-drawer-overlay.open { display: block; }

.map-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 340px; background: #0f172a; /* Dark theme */
  color: #f1f5f9;
  z-index: 1030; transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.3);
  will-change: transform;
}
.map-drawer.open { transform: translateX(0); }
.map-drawer-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; scrollbar-color: #334155 transparent; }

/* ── MAP SIDEBAR CUSTOM UI ───────────────────────────── */
.ms-header { font-size: 12px; font-weight: 700; color: #94a3b8; text-transform: uppercase; margin-bottom: 8px; letter-spacing: 0.5px; }
.ms-section { background: #1e293b; border-radius: 8px; padding: 14px; border: 1px solid #334155; }

/* Custom Checkbox List */
.ms-cb-list { display: flex; flex-direction: column; gap: 10px; max-height: 180px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #334155 transparent; }
.ms-cb-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: #e2e8f0; position: relative; user-select: none; }
.ms-cb-label input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.ms-checkmark { height: 16px; width: 16px; background-color: #334155; border-radius: 3px; display: flex; align-items: center; justify-content: center; }
.ms-cb-label:hover input ~ .ms-checkmark { background-color: #475569; }
.ms-cb-label input:checked ~ .ms-checkmark { background-color: #3b82f6; }
.ms-checkmark:after { content: ""; display: none; width: 4px; height: 8px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); margin-bottom: 2px; }
.ms-cb-label input:checked ~ .ms-checkmark:after { display: block; }
.ms-color-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* Filter Inputs */
.ms-filter-inputs { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.ms-input { background: #ffffff; color: #0f172a; border: none; padding: 10px 12px; border-radius: 6px; font-size: 14px; outline: none; width: 100%; font-family: inherit; }
.ms-action-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.ms-btn-blue { background: #2563eb; color: white; border: none; padding: 10px; border-radius: 6px; font-weight: 600; cursor: pointer; transition: 0.2s; }
.ms-btn-blue:hover { background: #1d4ed8; }
.ms-btn-red { background: #dc2626; color: white; border: none; padding: 10px; border-radius: 6px; font-weight: 600; cursor: pointer; transition: 0.2s; }
.ms-btn-red:hover { background: #b91c1c; }

/* Performance Render */
.ms-perf-list { display: flex; flex-direction: column; gap: 12px; }
.perf-row { display: flex; flex-direction: column; gap: 4px; }
.perf-label { font-size: 13px; font-weight: 700; color: #f8fafc; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.perf-bar-bg { width: 100%; height: 14px; position: relative; }

.perf-bar { height: 100%; border-radius: 2px; transition: width 0.5s ease-out; }

/* Total Banner */
.ms-total-banner { background: #2563eb; color: white; padding: 14px; border-radius: 8px; text-align: center; font-weight: 700; font-size: 16px; margin: 8px 0; border: 1px solid #1d4ed8; }

/* Visit List */
.ms-visit-list { display: flex; flex-direction: column; gap: 16px; padding: 4px; max-height: 260px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #334155 transparent; }
.ms-visit-item { display:flex; flex-direction:column; gap:4px; position:relative; padding-left: 16px; border-bottom: 1px solid #334155; padding-bottom: 12px; }
.ms-visit-item:last-child { border-bottom: none; padding-bottom: 0; }
.ms-v-dot { position: absolute; left: 0; top: 6px; width: 8px; height: 8px; border-radius: 50%; }
.ms-v-store { font-weight: 700; font-size: 14px; color: #94a3b8; text-transform: uppercase; }
.ms-v-meta { font-size: 13px; color: #94a3b8; }
.ms-visit-clickable { cursor: pointer; border-radius: 6px; transition: background 0.15s; }
.ms-visit-clickable:hover { background: #1e3a5f; }
.ms-search-box { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ms-btn-search { background: #2563eb; color: white; border: none; padding: 10px; border-radius: 6px; font-weight: 600; font-size: 13px; cursor: pointer; transition: 0.2s; }
.ms-btn-search:hover { background: #1d4ed8; }


.app-footer { text-align: center; font-size: 11px; color: var(--text-muted); opacity: 0.45; padding: 14px 0 22px; letter-spacing: 0.4px; }

/* ── PENJUALAN ──────────────────────────────────────────── */
.pj-wrap { padding: 0; }
.pj-topbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.pj-title { font-size: 16px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.pj-filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pj-input { padding: 7px 10px; border: 1px solid #334155; border-radius: 6px; background: var(--surface); color: var(--text); font-size: 13px; }
.pj-kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
@media (max-width: 768px) { .pj-kpi-grid { grid-template-columns: repeat(2, 1fr); } .pj-topbar { flex-direction: column; align-items: flex-start; } }
.pj-kpi { background: var(--surface); border: 1px solid #334155; border-radius: 10px; padding: 16px; text-align: center; }
.pj-kpi-accent { border-color: var(--success); background: rgba(16,185,129,0.07); }
.pj-kpi-num { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1.1; }
.pj-kpi-accent .pj-kpi-num { color: var(--success); }
.pj-kpi-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.pj-section-title { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.pj-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pj-table th { background: var(--primary); color: #94a3b8; font-size: 11px; font-weight: 600; text-transform: uppercase; padding: 8px 10px; text-align: center; }
.pj-table td { padding: 8px 10px; border-bottom: 1px solid #1e293b; text-align: center; color: #e2e8f0; background: #0f172a; }
.pj-table tbody tr:hover td { background: #1a2740; }
.pj-total-row td { background: #1e293b; font-weight: 700; border-top: 2px solid #334155; color: #f1f5f9; }

/* ── MOBILE OPTIMIZATIONS ────────────────────────────── */

/* Hover effects hanya untuk perangkat yang support hover (bukan touchscreen) */
@media (hover: none) {
  .module-primary:hover { transform: none; box-shadow: none; }
  .module-card:hover    { transform: none; box-shadow: none; }
  .module-primary:active { opacity: 0.88; }
  .module-card:active    { opacity: 0.88; }
}

@media (max-width: 768px) {
  /* Cegah iOS auto-zoom saat tap input — wajib font-size >= 16px */
  .login-form input,
  .form-group input:not([type="color"]),
  .form-group select,
  .form-group textarea,
  .product-row select,
  .product-row input,
  .filter-bar input,
  .filter-bar select,
  .dk-bar-input,
  .ms-input,
  .pj-input { font-size: 16px; }

  /* Hapus backdrop-filter blur — berat di HP Android lama */
  .drawer-overlay,
  .dk-filter-overlay,
  .map-drawer-overlay { backdrop-filter: none; }

  /* Peta lebih pendek di mobile agar tidak memenuhi layar */
  #map { height: 320px; }
}
