/* style.css - Desain UI Modern, Presisi & Responsif untuk Mobile & Desktop */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-hover: #15803d;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --info: #0284c7;
  --info-light: #f0f9ff;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: clip;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

/* Auth / Login Page Layout */
.auth-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: #f1f5f9;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow-lg);
}

/* Layout Containers */
.container {
  width: 100%;
  max-width: 760px;
  min-width: 0;
  margin: 0 auto;
  padding: 1.25rem 1rem;
  flex: 1;
}

.container-wide {
  width: 100%;
  max-width: 1200px;
  min-width: 0;
  margin: 0 auto;
  padding: 1.25rem 1rem;
  flex: 1;
}

/* Top Navbar */
.navbar {
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  flex-shrink: 0;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
  min-width: 0;
}

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

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Dashboard Banner */
.dashboard-banner {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-md);
}

.dashboard-banner-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}

.dashboard-clock {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.1;
}

.schedule-pill {
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Attendance Action Cards */
.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  cursor: pointer;
  min-height: 140px;
}

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

.action-card:active {
  transform: scale(0.98);
}

.action-card.disabled {
  opacity: 0.7;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

.action-card.disabled:hover {
  transform: none;
  box-shadow: none;
}

.action-card.disabled:active {
  transform: none;
}

.action-card-masuk {
  background: var(--success-light);
  border-color: #86efac;
}
.action-card-masuk:hover { border-color: var(--success); }

.action-card-pulang {
  background: var(--warning-light);
  border-color: #fde047;
}
.action-card-pulang:hover { border-color: var(--warning); }

.action-card-kunjungan {
  background: var(--info-light);
  border-color: #93c5fd;
}
.action-card-kunjungan:hover { border-color: var(--info); }

.action-card.action-card-locked {
  background: var(--danger-light);
  border-color: #fca5a5;
  opacity: 0.92;
  filter: none;
  cursor: pointer;
}
.action-card.action-card-locked:hover {
  border-color: var(--danger);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  min-height: 42px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  gap: 0.45rem;
  user-select: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

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

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

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

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.btn-outline:hover {
  background: #f1f5f9;
}

.btn-sm {
  min-height: 34px;
  padding: 0.35rem 0.75rem;
  font-size: 0.825rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

/* Form Inputs */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

/* Minimum 16px font-size prevents iOS Safari automatic zoom-in */
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 16px;
  color: var(--text-main);
  background-color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

@media (min-width: 641px) {
  .form-input, .form-textarea, .form-select {
    font-size: 0.925rem;
  }
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Stepper Wizard (Mathematical precision across all device widths) */
.stepper-container {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  position: relative;
}

.stepper-container::before {
  content: "";
  position: absolute;
  top: 17px;
  left: 12.5%;
  right: 12.5%;
  height: 2px;
  background-color: var(--border-color);
  z-index: 1;
}

.stepper-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  text-align: center;
}

.stepper-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
}

.stepper-dot.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.stepper-dot.completed {
  background: var(--success);
  color: #fff;
}

.stepper-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stepper-item.active .stepper-label {
  color: var(--primary);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25;
}

.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-outline-success { border: 1px solid #16a34a; color: #16a34a; background: transparent; }

/* Camera UI */
.camera-mode-switcher {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  max-width: 440px;
  margin: 0 auto 0.75rem auto;
  padding: 0.3rem;
  background-color: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.camera-mode-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
  cursor: pointer;
  transition: all 0.18s ease;
}

.camera-mode-btn:hover:not(:disabled) {
  color: #0f172a;
  background-color: rgba(255, 255, 255, 0.6);
}

.camera-mode-btn.active {
  color: var(--primary-color);
  background-color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.camera-mode-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.camera-box {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-color: #0f172a;
  position: relative;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.camera-box video, .camera-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-box video.is-front-camera {
  transform: scaleX(-1);
}

.camera-box video.is-rear-camera {
  transform: none;
}

.camera-live-badge {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  pointer-events: none;
}

.camera-flip-overlay-btn {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.camera-flip-overlay-btn:hover:not(:disabled) {
  background: rgba(37, 99, 235, 0.9);
}

.camera-flip-overlay-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.camera-flip-overlay-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.camera-guide-overlay {
  position: absolute;
  width: min(200px, 55%);
  height: min(240px, 75%);
  border: 2px dashed rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.2);
}

/* History List */
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-color);
  gap: 0.75rem;
}
.history-item:last-child {
  border-bottom: none;
}
.history-item-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
  min-width: 0;
}
.history-thumbnail {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

/* Chat bubble preview */
.chat-bubble {
  background-color: #dcf8c6;
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 0.75rem;
  border-left: 4px solid #25d366;
  box-shadow: var(--shadow-sm);
}
.chat-bubble-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

/* Navigation Pills for Admin Sections */
.nav-pills-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  background: #e2e8f0;
  padding: 0.35rem;
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.nav-pills {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 transparent;
  padding: 2px 0.2rem 4px 0.2rem;
}

.nav-pills.is-scrollable {
  cursor: grab;
}

.nav-pills.is-dragging,
.nav-pills.is-dragging .nav-pill {
  cursor: grabbing;
}

.nav-pills::-webkit-scrollbar {
  height: 5px;
}
.nav-pills::-webkit-scrollbar-track {
  background: transparent;
}
.nav-pills::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.45);
  border-radius: 9999px;
}
.nav-pills::-webkit-scrollbar-thumb:hover {
  background: rgba(71, 85, 105, 0.75);
}

.nav-pill {
  padding: 0.5rem 0.85rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  user-select: none;
  -webkit-user-select: none;
}

.nav-pill:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.45);
}

.nav-pill.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.nav-scroll-btn {
  flex: 0 0 auto;
  width: 30px;
  height: 34px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--text-main);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}

.nav-scroll-btn:hover:not(:disabled) {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--border-focus);
}

.nav-scroll-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Admin Grids (Responsive on Laptop & Mobile) */
.admin-attendance-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.admin-user-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

/* Stat Cards */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-num {
  font-size: 1.6rem;
  font-weight: 800;
  margin-top: 0.25rem;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* Filter Box */
.filter-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.date-range-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

table.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 600px;
}

table.custom-table th {
  background: #f1f5f9;
  padding: 0.65rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

table.custom-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
  vertical-align: top;
}

/* Attendance Table Cleanup & Always-Clickable Action Buttons */
.attendance-table {
  min-width: 780px;
}

.attendance-table th,
.attendance-table td {
  padding: 0.65rem 0.75rem;
}

.attendance-table td.att-col-status {
  min-width: 185px;
  max-width: 280px;
  white-space: normal;
  word-break: break-word;
}

.attendance-table td.att-col-distance {
  min-width: 115px;
  max-width: 180px;
  white-space: normal;
  word-break: break-word;
}

.attendance-table th.attendance-action-cell,
.attendance-table td.attendance-action-cell {
  position: sticky;
  right: 0;
  z-index: 3;
  white-space: nowrap;
  min-width: 152px;
  text-align: right;
  pointer-events: auto;
  box-shadow: -4px 0 8px -4px rgba(15, 23, 42, 0.1);
}

.attendance-table th.attendance-action-cell {
  background: #f1f5f9;
  z-index: 4;
}

.attendance-table td.attendance-action-cell {
  background: #ffffff;
  vertical-align: middle;
}

.attendance-table tbody tr:hover td {
  background-color: #f8fafc;
}

.attendance-table tbody tr:hover td.attendance-action-cell {
  background-color: #f8fafc;
}

.attendance-action-cell .btn-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 0.35rem;
  position: relative;
  z-index: 5;
  pointer-events: auto;
}

.attendance-action-cell .btn {
  min-height: 32px;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  cursor: pointer;
  pointer-events: auto;
}

.table-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-color);
  display: block;
}

/* Tabs */
.tabs-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.tabs-nav::-webkit-scrollbar {
  height: 4px;
}
.tabs-nav::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.55);
  border-radius: 9999px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tab-btn:hover {
  color: var(--text-main);
}
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 0.4rem;
  border-radius: 9999px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  background: #e2e8f0;
  color: #334155;
}
.tab-btn.active .tab-count-badge {
  background: #dbeafe;
  color: #1d4ed8;
}
.tab-count-badge-warning {
  background: #fef3c7;
  color: #b45309;
}
.tab-count-badge-whatsapp {
  background: #dcfce7;
  color: #15803d;
}

/* Attendance Chat Tab Panel */
.attendance-chat-info {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.85rem;
  color: #166534;
}

.attendance-chat-list {
  max-height: 540px;
  overflow-y: auto;
  padding-right: 0.15rem;
}

/* Standard Grids */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

/* Compact Horizontal KPI Strip (Rekap & Grafik Kunjungan) */
.kpi-horizontal-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  width: 100%;
}

.stat-card-horizontal {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.68rem 0.85rem;
  text-align: left;
  margin-bottom: 0;
  min-width: 0;
}

.stat-h-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.stat-h-icon-blue { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.stat-h-icon-green { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.stat-h-icon-purple { background: #f5f3ff; color: #7c3aed; border: 1px solid #ddd6fe; }
.stat-h-icon-orange { background: #fff7ed; color: #ea580c; border: 1px solid #fed7aa; }
.stat-h-icon-red { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.stat-h-icon-slate { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }

.stat-h-content {
  flex: 1;
  min-width: 0;
}

.stat-card-horizontal .stat-label {
  font-size: 0.66rem;
  letter-spacing: 0.35px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card-horizontal .stat-num {
  font-size: 1.2rem;
  font-weight: 800;
  margin-top: 0.1rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card-horizontal .stat-num.wa-stat-server-text {
  font-size: 0.86rem;
}

.stat-h-sub {
  font-size: 0.69rem;
  line-height: 1.2;
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.late-kpi-horizontal {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  width: 100%;
}

.late-kpi-horizontal > div {
  min-width: 0;
}

/* Horizontal Compact Strip & 4-Step Guide untuk Section Bot WhatsApp */
.stats-grid {
  display: grid;
  gap: 0.75rem;
  width: 100%;
}

.wa-kpi-horizontal-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
  width: 100%;
}

.wa-steps-horizontal {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  width: 100%;
}

.wa-step-pill {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-size: 0.74rem;
  line-height: 1.4;
  color: #0c4a6e;
  min-width: 0;
}

.wa-step-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  color: #0369a1;
  margin-bottom: 0.18rem;
  font-size: 0.75rem;
}

.wa-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0284c7;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  flex-shrink: 0;
}

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-gray-700 { color: #334155; }
.text-red-600 { color: #dc2626; }
.text-green-600 { color: #16a34a; }
.text-blue-600 { color: #2563eb; }
.text-orange-600 { color: #ea580c; }
.text-purple-600 { color: #7c3aed; }
.text-main { color: var(--text-main); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

/* ============================================================
   RESPONSIVE MEDIA QUERIES (Mobile, Tablet, Laptop & Desktop)
   ============================================================ */

/* Mobile Phones (up to 640px) */
@media (max-width: 640px) {
  .container, .container-wide {
    padding: 1rem 0.75rem;
  }

  .navbar {
    padding: 0.65rem 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .navbar-actions {
    flex: 0 1 auto;
    max-width: 100%;
    margin-left: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 2px;
  }

  .navbar-actions .btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.76rem;
    min-height: 32px;
  }

  .nav-pills-wrapper {
    padding: 0.3rem;
    gap: 0.25rem;
  }

  .nav-scroll-btn {
    width: 28px;
    height: 32px;
    font-size: 1.05rem;
  }

  .nav-pill {
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
  }

  .grid-2, .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .kpi-horizontal-strip,
  .late-kpi-horizontal {
    grid-template-columns: repeat(4, minmax(155px, 1fr));
    gap: 0.45rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
  }

  .wa-kpi-horizontal-strip {
    grid-template-columns: repeat(5, minmax(162px, 1fr));
    gap: 0.45rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
  }

  .wa-steps-horizontal {
    grid-template-columns: repeat(4, minmax(185px, 1fr));
    gap: 0.45rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
  }

  .stat-card-horizontal {
    padding: 0.55rem 0.65rem;
    gap: 0.5rem;
  }

  .stat-h-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .stat-card-horizontal .stat-num {
    font-size: 1.05rem;
  }

  .stat-card-horizontal .stat-num.wa-stat-server-text {
    font-size: 0.84rem;
  }

  .admin-attendance-grid, .admin-user-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .date-range-container {
    flex-direction: column;
    align-items: stretch;
  }

  .date-range-container span {
    text-align: center;
  }

  .dashboard-banner-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-banner-header > div:last-child {
    text-align: left;
    margin-top: 0.5rem;
  }

  .history-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .history-item > div:last-child {
    text-align: left;
    margin-left: 56px; /* indent past thumbnail */
  }

  .stepper-label {
    font-size: 0.7rem;
  }

  .monthly-chart-controls {
    width: 100%;
    justify-content: space-between;
  }

  .monthly-chart-controls-wrap {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .monthly-employee-select {
    width: 100%;
    max-width: 100%;
    font-size: 16px;
  }

  .monthly-month-input {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 16px;
  }

  .monthly-visit-stats {
    gap: 0.4rem;
  }

  .monthly-visit-stats-4 {
    grid-template-columns: repeat(4, minmax(115px, 1fr));
    gap: 0.4rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
  }

  .monthly-stat-pill {
    padding: 0.45rem 0.5rem;
  }

  .monthly-stat-label {
    font-size: 0.6rem;
  }

  .monthly-stat-val {
    font-size: 0.88rem;
  }
}

/* Tablets (641px - 992px) */
@media (min-width: 641px) and (max-width: 992px) {
  .navbar-actions {
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: thin;
  }

  .admin-attendance-grid, .admin-user-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-horizontal-strip,
  .late-kpi-horizontal {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 0.55rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.2rem;
  }

  .wa-kpi-horizontal-strip {
    grid-template-columns: repeat(5, minmax(158px, 1fr));
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    padding-bottom: 0.2rem;
    scrollbar-width: thin;
  }

  .wa-steps-horizontal {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }
}

/* ============================================================ */
/* HALAMAN TERIMA KASIH — Overlay Absen Pulang                  */
/* ============================================================ */

.thankyou-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f2744 40%, #1a1035 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  animation: ty-fadein 0.5s ease forwards;
}

.thankyou-overlay.hidden {
  display: none;
}

@keyframes ty-fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.thankyou-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: 2rem 1.75rem 1.75rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: ty-slideup 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes ty-slideup {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Bintang dekoratif */
.thankyou-stars {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  overflow: hidden;
}

.star {
  position: absolute;
  font-size: 1.4rem;
  opacity: 0;
  animation: ty-star-float 3.5s ease-in-out infinite;
}
.s1 { left: 10%;  top: 15%; animation-delay: 0s;    animation-duration: 3.2s; }
.s2 { left: 80%;  top: 10%; animation-delay: 0.6s;  animation-duration: 3.8s; }
.s3 { left: 50%;  top: 5%;  animation-delay: 1.1s;  animation-duration: 3.5s; }
.s4 { left: 25%;  top: 70%; animation-delay: 1.7s;  animation-duration: 4s;   }
.s5 { left: 70%;  top: 65%; animation-delay: 0.9s;  animation-duration: 3.3s; }

@keyframes ty-star-float {
  0%   { opacity: 0;   transform: translateY(0)    scale(0.8); }
  30%  { opacity: 0.8; }
  70%  { opacity: 0.6; }
  100% { opacity: 0;   transform: translateY(-40px) scale(1.2); }
}

/* Ikon rumah besar */
.thankyou-icon {
  font-size: 4rem;
  margin-bottom: 0.75rem;
  animation: ty-bounce 1s ease 0.4s both;
  display: block;
}

@keyframes ty-bounce {
  0%   { transform: scale(0);   opacity: 0; }
  60%  { transform: scale(1.2); opacity: 1; }
  80%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* Judul */
.thankyou-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

/* Pesan utama */
.thankyou-message {
  margin-bottom: 1.25rem;
}

.thankyou-main-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fde68a;
  margin-bottom: 0.4rem;
}

.thankyou-sub-text {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.6;
}

/* Info box ringkasan pulang */
.thankyou-info-box {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  text-align: left;
}

.thankyou-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.thankyou-info-row:last-child {
  border-bottom: none;
}

.thankyou-info-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
}

.thankyou-info-value {
  font-size: 0.8rem;
  color: #ffffff;
  font-weight: 600;
  text-align: right;
  max-width: 55%;
}

/* Quote motivasi */
.thankyou-quote {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
  font-style: italic;
  margin-bottom: 1.25rem;
  padding: 0 0.5rem;
  line-height: 1.5;
  min-height: 2.5rem;
}

/* Tombol kembali */
.thankyou-btn {
  font-size: 1rem;
  font-weight: 700;
  padding: 0.85rem;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #16a34a, #15803d) !important;
  border: none !important;
  color: #fff !important;
  box-shadow: 0 4px 15px rgba(22, 163, 74, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}

.thankyou-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(22, 163, 74, 0.5);
}

/* Countdown */
.thankyou-countdown {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
  margin: 0;
}

.thankyou-countdown span {
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
}

/* ============================================================
   KUNJUNGAN DASHBOARD STYLES
   ============================================================ */

/* Navbar link active indicator */
.navbar-link-active {
  background-color: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* Badge total kunjungan harian */
.badge-visit-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: 9999px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  box-shadow: 0 1px 2px rgba(29, 78, 216, 0.08);
}
.badge-visit-count.high {
  background: #f0fdf4;
  color: #15803d;
  border-color: #86efac;
}
.badge-visit-count.medium {
  background: #eef2ff;
  color: #4338ca;
  border-color: #c7d2fe;
}

/* Tag destinasi kunjungan klien */
.client-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.client-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 0.75rem;
  color: #334155;
  line-height: 1.3;
}
.client-tag .client-time {
  font-weight: 700;
  color: #2563eb;
  font-size: 0.7rem;
}

/* Quick Date Range Filter (1 Minggu / 5 Hari Kerja per Bulan Berjalan) */
.quick-range-section {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
}
.quick-range-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.quick-week-month-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.quick-week-month-input {
  width: auto;
  min-width: 142px;
  min-height: 32px;
  padding: 0.25rem 0.55rem;
  font-size: 0.8rem;
  line-height: 1.25;
}
.date-pill-scroll {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  margin-top: 0.55rem;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}
.quick-date-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.78rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: #fff;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.quick-date-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.quick-date-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.quick-week-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.08rem 0.4rem;
  border-radius: 9999px;
  font-size: 0.66rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #334155;
}
.quick-date-pill.active .quick-week-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Modal Popup Detail & Form */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}
.modal-overlay.hidden {
  display: none !important;
}
.modal-card {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  display: flex;
  flex-direction: column;
}
.modal-card-header {
  padding: 1.15rem 1.4rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 10;
}
.modal-card-body {
  padding: 1.35rem 1.4rem;
  flex: 1;
}

/* Timeline Kunjungan di dalam Modal */
.visit-timeline-item {
  position: relative;
  padding-left: 1.5rem;
  padding-bottom: 1.5rem;
  border-left: 2px solid #cbd5e1;
}
.visit-timeline-item:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}
.visit-timeline-dot {
  position: absolute;
  left: -7px;
  top: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* ============================================================
   CHART CARD & CANVAS STYLES
   ============================================================ */
.chart-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.5rem;
}
.chart-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.chart-canvas-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}
.chart-canvas-wrapper canvas {
  max-width: 100%;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-color);
  font-size: 0.75rem;
}
.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-main);
}
.chart-legend-color {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ============================================================
   GRAFIK KUNJUNGAN HARIAN 1 BULAN DI DASHBOARD KARYAWAN
   ============================================================ */
.monthly-chart-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  max-width: 100%;
}

.monthly-nav-btn {
  min-height: 34px;
  width: 32px;
  padding: 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
}

.monthly-month-input {
  width: auto;
  min-width: 148px;
  min-height: 34px;
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
  line-height: 1.25;
}

.monthly-visit-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.monthly-stat-pill {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.monthly-stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}

.monthly-stat-val {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.daily-visit-chart-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff;
  padding: 0.45rem 0.25rem 0.35rem 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.daily-visit-chart-scroll::-webkit-scrollbar {
  height: 5px;
}
.daily-visit-chart-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.65);
  border-radius: 9999px;
}

.daily-visit-chart-stage {
  position: relative;
  width: 100%;
}

.daily-visit-chart-stage canvas {
  display: block;
}

.monthly-visit-detail {
  margin-top: 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.8rem;
  color: var(--text-main);
}

.monthly-visit-detail-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.monthly-visit-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.22rem 0.55rem;
  font-size: 0.75rem;
  color: #334155;
}

.monthly-visit-chip-time {
  font-weight: 700;
  color: var(--primary);
}

/* Tambahan Grafik 1 Bulan Semua Karyawan (Portal Admin & Rekap Kunjungan) */
.monthly-chart-controls-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  max-width: 100%;
}

.monthly-employee-select {
  width: auto;
  min-width: 185px;
  max-width: 260px;
  min-height: 34px;
  padding: 0.3rem 0.65rem;
  font-size: 0.84rem;
  line-height: 1.25;
}

.monthly-visit-stats-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.monthly-legend-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.7rem;
  align-items: center;
}

.monthly-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: 0.22rem 0.62rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.monthly-legend-chip:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.monthly-legend-chip.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.monthly-legend-chip-reset {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

.monthly-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.monthly-legend-count {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.monthly-admin-emp-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.55rem;
}

.monthly-admin-emp-group {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
}

.monthly-admin-emp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.monthly-admin-emp-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Grafik Jam Kunjungan per Karyawan (08:00 - 23:59 Per Jam) */
.hourly-mode-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 2px;
}

.hourly-mode-btn {
  min-height: 30px !important;
  padding: 0.25rem 0.62rem !important;
  font-size: 0.76rem !important;
  border-radius: 6px !important;
  border: none !important;
  white-space: nowrap;
}

.hourly-chart-tooltip {
  position: absolute;
  z-index: 25;
  min-width: 195px;
  max-width: 280px;
  background: rgba(15, 23, 42, 0.96);
  color: #f8fafc;
  border-radius: 10px;
  padding: 0.6rem 0.72rem;
  font-size: 0.74rem;
  line-height: 1.4;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.28);
  border: 1px solid rgba(148, 163, 184, 0.28);
  pointer-events: none;
}

.hourly-chart-tooltip .monthly-legend-dot {
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.hourly-tooltip-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.28rem;
  font-size: 0.77rem;
}

.hourly-tooltip-badge {
  background: rgba(59, 130, 246, 0.28);
  color: #bfdbfe;
  border: 1px solid rgba(147, 197, 253, 0.4);
  border-radius: 9999px;
  padding: 0.08rem 0.45rem;
  font-size: 0.67rem;
  font-weight: 700;
  flex-shrink: 0;
}

.hourly-tooltip-sub {
  color: #cbd5e1;
  font-size: 0.71rem;
  margin-bottom: 0.24rem;
}

.hourly-tooltip-list {
  display: flex;
  flex-direction: column;
  gap: 0.24rem;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  padding-top: 0.28rem;
}

.hourly-tooltip-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.hourly-tooltip-name {
  font-weight: 600;
  color: #f8fafc;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hourly-tooltip-val {
  color: #93c5fd;
  font-weight: 600;
  font-size: 0.7rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.hourly-tooltip-visit {
  color: #e2e8f0;
  font-size: 0.7rem;
  line-height: 1.38;
  padding: 0.12rem 0;
}

.hourly-tooltip-more {
  color: #94a3b8;
  font-size: 0.68rem;
  font-style: italic;
  margin-top: 0.14rem;
}

@media (max-width: 640px) {
  .hourly-mode-switcher {
    width: 100%;
    justify-content: stretch;
  }

  .hourly-mode-btn {
    flex: 1 1 0;
    justify-content: center;
  }

  .hourly-chart-tooltip {
    max-width: 220px;
    font-size: 0.7rem;
  }
}

/* Global Site Footer */
.site-footer {
  width: 100%;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.78rem;
  text-align: center;
  padding: 0.85rem 1rem;
  margin-top: auto;
}

.site-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.site-footer strong {
  color: var(--text-main);
  font-weight: 700;
}

@media print {
  .site-footer {
    display: none;
  }
}

/* ============================================================
   LOGIN BUTTON ENTER BADGE & INVALID CREDENTIALS POPUP MODAL
   ============================================================ */
.login-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  position: relative;
}

.login-enter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.14rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.38);
  color: #ffffff;
  letter-spacing: 0.2px;
}

.login-enter-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.65rem;
}

.login-popup-card {
  max-width: 390px;
  width: 100%;
  text-align: center;
  padding: 1.65rem 1.4rem 1.4rem;
  border: 1px solid #fecaca;
  animation: login-pop-in 0.18s ease-out;
}

@keyframes login-pop-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.login-popup-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 0.85rem;
  border-radius: 50%;
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.65rem;
}

.login-popup-title {
  font-size: 1.12rem;
  font-weight: 800;
  color: #991b1b;
  margin-bottom: 0.45rem;
}

.login-popup-message {
  font-size: 0.88rem;
  color: #334155;
  line-height: 1.5;
  margin-bottom: 1.2rem;
}

/* ============================================================
   MANAJEMEN PENGGUNA & KUNCI KATA SANDI (EDIT USER)
   ============================================================ */
.users-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.users-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 5;
}

.users-header-actions .btn {
  cursor: pointer;
  pointer-events: auto;
  min-height: 36px;
}

.users-template-banner {
  margin: 0 0 0.85rem 0;
  padding: 0.65rem 0.9rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.users-table {
  min-width: 780px;
}

.users-table th,
.users-table td {
  padding: 0.7rem 0.75rem;
  vertical-align: middle;
}

.users-table th.users-action-cell,
.users-table td.users-action-cell {
  position: sticky;
  right: 0;
  z-index: 3;
  white-space: nowrap;
  min-width: 215px;
  text-align: right;
  pointer-events: auto;
  box-shadow: -4px 0 8px -4px rgba(15, 23, 42, 0.1);
}

.users-table th.users-action-cell {
  background: #f1f5f9;
  z-index: 4;
}

.users-table td.users-action-cell {
  background: #ffffff;
}

.users-table tbody tr:hover td {
  background-color: #f8fafc;
}

.users-table tbody tr:hover td.users-action-cell {
  background-color: #f8fafc;
}

.users-action-cell .btn-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 0.35rem;
  position: relative;
  z-index: 5;
  pointer-events: auto;
}

.users-action-cell .btn {
  min-height: 32px;
  padding: 0.3rem 0.6rem;
  font-size: 0.76rem;
  cursor: pointer;
  pointer-events: auto;
}

/* Password Lock + Checkbox Reset Password (Edit Pengguna) */
.password-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}

.reset-password-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.15s ease;
}

.reset-password-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.reset-password-toggle.is-unlocked {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.reset-password-toggle input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
}

.password-locked-input:disabled,
.form-input:disabled {
  background-color: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
  cursor: not-allowed;
  opacity: 0.92;
}

@media (max-width: 640px) {
  .users-header-actions,
  .offices-header-actions {
    width: 100%;
  }

  .users-header-actions .btn,
  .offices-header-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .quick-week-month-controls {
    width: 100%;
    justify-content: space-between;
  }

  .quick-week-month-input {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 16px;
  }

  .checkin-success-card {
    padding: 1.35rem 1.1rem 1.15rem;
  }
}

/* ============================================================
   MANAJEMEN LOKASI KANTOR (LIST FULL-WIDTH & AKSI KLIKABEL)
   ============================================================ */
.offices-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.offices-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 5;
}

.offices-header-actions .btn {
  cursor: pointer;
  pointer-events: auto;
  min-height: 36px;
}

.offices-table {
  min-width: 760px;
}

.offices-table th,
.offices-table td {
  padding: 0.7rem 0.75rem;
  vertical-align: middle;
}

.offices-table th.offices-action-cell,
.offices-table td.offices-action-cell {
  position: sticky;
  right: 0;
  z-index: 3;
  white-space: nowrap;
  min-width: 165px;
  text-align: right;
  pointer-events: auto;
  box-shadow: -4px 0 8px -4px rgba(15, 23, 42, 0.1);
}

.offices-table th.offices-action-cell {
  background: #f1f5f9;
  z-index: 4;
}

.offices-table td.offices-action-cell {
  background: #ffffff;
}

.offices-table tbody tr:hover td {
  background-color: #f8fafc;
}

.offices-table tbody tr:hover td.offices-action-cell {
  background-color: #f8fafc;
}

.offices-action-cell .btn-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 0.35rem;
  position: relative;
  z-index: 5;
  pointer-events: auto;
}

.offices-action-cell .btn {
  min-height: 32px;
  padding: 0.3rem 0.6rem;
  font-size: 0.76rem;
  cursor: pointer;
  pointer-events: auto;
}

/* ============================================================
   POPUP ABSEN MASUK BERHASIL + MOTIVASI HARIAN
   ============================================================ */
.checkin-success-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
  animation: ty-fadein 0.28s ease forwards;
}

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

.checkin-success-card {
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 18px;
  padding: 1.65rem 1.5rem 1.35rem;
  max-width: 470px;
  width: 100%;
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.28);
  text-align: center;
  animation: ty-slideup 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.checkin-success-badge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}

.checkin-success-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ecfdf5, #eff6ff);
  border: 2px solid #bbf7d0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.checkin-success-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.75rem;
  border-radius: 9999px;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.35px;
}

.checkin-success-status-pill.is-late {
  background: #ffedd5;
  color: #9a3412;
  border-color: #fdba74;
}

.checkin-success-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 0.3rem;
}

.checkin-success-subtitle {
  font-size: 0.84rem;
  color: #475569;
  margin: 0 0 1rem;
  line-height: 1.45;
}

.checkin-motivation-box {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 0.8rem 0.95rem;
  text-align: left;
  margin-bottom: 1rem;
}

.checkin-motivation-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.7rem;
  font-weight: 700;
  color: #1d4ed8;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  margin-bottom: 0.35rem;
}

.checkin-motivation-date {
  font-weight: 600;
  color: #475569;
  text-transform: none;
  letter-spacing: 0;
}

.checkin-motivation-quote {
  margin: 0;
  font-size: 0.86rem;
  font-style: italic;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.5;
}

.checkin-data-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.75rem 0.95rem;
  margin-bottom: 0.95rem;
  text-align: left;
}

.checkin-data-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.32rem 0;
  border-bottom: 1px dashed #e2e8f0;
}

.checkin-data-row:last-child {
  border-bottom: none;
}

.checkin-data-label {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  flex-shrink: 0;
}

.checkin-data-value {
  font-size: 0.78rem;
  color: #0f172a;
  font-weight: 700;
  text-align: right;
  word-break: break-word;
}

.checkin-late-notice {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.9rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #9a3412;
  text-align: left;
}

.checkin-continue-btn {
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  margin-bottom: 0.55rem;
}

.checkin-countdown {
  margin: 0;
  font-size: 0.75rem;
  color: #64748b;
}

.checkin-countdown span {
  font-weight: 800;
  color: var(--primary);
}

/* ============================================================
   NOTIFIKASI KETERLAMBATAN HARI KERJA DITOLAK ADMIN (1 BULAN)
   ============================================================ */
.monthly-late-rejection-card {
  background: linear-gradient(135deg, #fef2f2 0%, #fff7ed 100%);
  border: 1px solid #fecaca;
  border-left: 5px solid #dc2626;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.08);
}

.monthly-late-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.monthly-late-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex: 1;
  min-width: 220px;
}

.monthly-late-icon {
  font-size: 1.55rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.monthly-late-title {
  font-weight: 800;
  font-size: 0.94rem;
  color: #991b1b;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.monthly-late-summary-text {
  font-size: 0.83rem;
  color: #7f1d1d;
  margin-top: 0.28rem;
  line-height: 1.48;
}

.monthly-late-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.monthly-late-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #fecaca;
  border-radius: 9999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.73rem;
  font-weight: 700;
  color: #991b1b;
}

.monthly-late-stat-chip.is-neutral {
  border-color: #fed7aa;
  color: #9a3412;
}

.monthly-late-items {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.monthly-late-item {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.78rem;
  color: #1e293b;
}

.monthly-late-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-weight: 700;
  color: #991b1b;
}

.monthly-late-item-note {
  margin-top: 0.25rem;
  color: #7f1d1d;
  font-size: 0.75rem;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .monthly-late-rejection-card {
    padding: 0.85rem 0.95rem;
  }
}

/* ==================== PENGAJUAN IZIN / SAKIT / CUTI ==================== */
.attendance-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

@media (max-width: 720px) {
  .attendance-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }
}

@media (max-width: 380px) {
  .attendance-action-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.action-card-izin {
  background: #f5f3ff;
  border-color: #ddd6fe;
}
.action-card-izin:hover {
  border-color: #7c3aed;
}

.leave-upload-dropzone {
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  padding: 0.85rem;
  background: #f8fafc;
  text-align: center;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.leave-upload-dropzone:hover {
  border-color: #7c3aed;
  background: #faf5ff;
}

.leave-photo-preview-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.65rem;
  padding: 0.55rem 0.75rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  text-align: left;
}

.leave-photo-preview-img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  flex-shrink: 0;
}

/* ==================== SUB-MENU BOT WHATSAPP ==================== */
.wa-submenu-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
}

.wa-submenu-btn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  text-align: left;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1.5px solid var(--border-color);
  background: #f8fafc;
  color: var(--text-main);
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.12s ease;
}

.wa-submenu-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.wa-submenu-btn.active {
  background: #eff6ff;
  border-color: #2563eb;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.13);
}

.wa-submenu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  font-size: 1.08rem;
  flex-shrink: 0;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.wa-submenu-btn.active .wa-submenu-icon {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.wa-submenu-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.wa-submenu-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-weight: 700;
  font-size: 0.86rem;
  color: #0f172a;
  line-height: 1.25;
}

.wa-submenu-btn.active .wa-submenu-title {
  color: #1d4ed8;
}

.wa-submenu-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  line-height: 1.35;
  white-space: normal;
  overflow: hidden;
  overflow-wrap: break-word;
  word-break: normal;
}

.wa-submenu-panel {
  animation: waSubFadeIn 0.18s ease-out;
}

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

.wa-log-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.8rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.wa-log-filter-pills {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

@media (max-width: 860px) {
  .wa-submenu-nav {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .wa-submenu-btn {
    padding: 0.65rem 0.75rem;
  }
}

/* ==================== VALIDASI MASSAL PRESENSI (CHECKBOX & SETUJUI SEMUA) ==================== */
.attendance-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.75rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
}

.attendance-bulk-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: #065f46;
}

.attendance-bulk-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.attendance-table th.att-col-check,
.attendance-table td.att-col-check {
  width: 42px;
  min-width: 42px;
  text-align: center;
  vertical-align: middle;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.att-bulk-checkbox {
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: #16a34a;
  vertical-align: middle;
}

.attendance-table tbody tr.att-row-selected td {
  background-color: #ecfdf5;
}

.attendance-table tbody tr.att-row-selected:hover td {
  background-color: #dcfce7;
}

/* ==================== PETA & AREA LOKASI KARYAWAN (LEAFLET POLYGON) ==================== */
.work-area-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 960px) {
  .work-area-editor-grid {
    grid-template-columns: 1fr;
  }
}

.work-area-map-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
  padding: 0.5rem 0.65rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.work-area-leaflet-box {
  width: 100%;
  height: 430px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #e2e8f0;
  overflow: hidden;
  z-index: 1;
}

.work-area-leaflet-box.draw-mode-active {
  cursor: crosshair;
}

.employee-dashboard-leaflet-box {
  width: 100%;
  height: 310px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #e2e8f0;
  overflow: hidden;
  z-index: 1;
}

.work-area-emp-checklist {
  max-height: 225px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.35rem;
}

.work-area-emp-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.38rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.12s ease;
  font-size: 0.78rem;
}

.work-area-emp-item:hover {
  background: #f1f5f9;
}

.work-area-emp-item.is-checked {
  background: #eff6ff;
}

.work-area-emp-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #2563eb;
  cursor: pointer;
  flex-shrink: 0;
}

.color-swatch-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px #cbd5e1;
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.color-swatch-btn:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px #64748b;
}

.vertex-marker-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.35);
  user-select: none;
}

.employee-area-chip-list {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.employee-area-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.employee-area-chip:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.employee-area-chip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ============================================================
   DARK MODE (MODE GELAP) & TOMBOL TOGGLE TEMA GLOBAL
   ============================================================ */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-weight: 600;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.auth-wrapper {
  position: relative;
}

.auth-theme-toggle-floating {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 60;
  background: var(--card-bg);
  box-shadow: var(--shadow-md);
}

html[data-theme="dark"],
body[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.16);
  --success: #22c55e;
  --success-hover: #16a34a;
  --success-light: rgba(34, 197, 94, 0.14);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.15);
  --info: #38bdf8;
  --info-light: rgba(56, 189, 248, 0.14);
  --bg-color: #0b1120;
  --card-bg: #1e293b;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --border-focus: #60a5fa;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.45);
  --shadow-md: 0 4px 10px -1px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.65);
  color-scheme: dark;
}

html[data-theme="dark"] .auth-wrapper {
  background: #0b1120;
}

html[data-theme="dark"] .navbar {
  background-color: rgba(15, 23, 42, 0.94);
  border-bottom-color: #334155;
}

html[data-theme="dark"] .site-footer {
  background: #0f172a;
  border-top-color: #334155;
  color: #94a3b8;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .chart-card,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .auth-card {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

html[data-theme="dark"] .filter-box,
html[data-theme="dark"] .quick-range-section,
html[data-theme="dark"] .wa-log-toolbar,
html[data-theme="dark"] .work-area-map-toolbar,
html[data-theme="dark"] .leave-upload-dropzone,
html[data-theme="dark"] .checkin-data-box {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #e2e8f0;
}

html[data-theme="dark"] .form-input,
html[data-theme="dark"] .form-textarea,
html[data-theme="dark"] .form-select {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

html[data-theme="dark"] .form-input::placeholder,
html[data-theme="dark"] .form-textarea::placeholder {
  color: #64748b;
}

html[data-theme="dark"] .password-locked-input:disabled,
html[data-theme="dark"] .form-input:disabled {
  background-color: #1e293b !important;
  color: #64748b !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .btn-outline {
  border-color: #475569;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.45);
}

html[data-theme="dark"] .btn-outline:hover:not(:disabled) {
  background: #334155;
  border-color: #64748b;
  color: #ffffff;
}

html[data-theme="dark"] .nav-pills-wrapper {
  background: #0f172a;
  border: 1px solid #334155;
}

html[data-theme="dark"] .nav-pill {
  color: #94a3b8;
}

html[data-theme="dark"] .nav-pill:hover {
  color: #f1f5f9;
  background: rgba(51, 65, 85, 0.55);
}

html[data-theme="dark"] .nav-pill.active {
  background: #1e293b;
  color: #60a5fa;
  border: 1px solid #3b82f6;
}

html[data-theme="dark"] .nav-scroll-btn {
  background: #1e293b;
  border-color: #475569;
  color: #f1f5f9;
}

html[data-theme="dark"] .table-responsive {
  background: #1e293b;
  border-color: #334155;
}

html[data-theme="dark"] table.custom-table th,
html[data-theme="dark"] table.table th,
html[data-theme="dark"] .attendance-table th.attendance-action-cell,
html[data-theme="dark"] .users-table th.users-action-cell,
html[data-theme="dark"] .offices-table th.offices-action-cell {
  background: #0f172a !important;
  color: #94a3b8 !important;
  border-bottom: 1px solid #334155;
}

html[data-theme="dark"] table.custom-table td,
html[data-theme="dark"] table.table td {
  border-bottom-color: #334155;
  color: #e2e8f0;
}

html[data-theme="dark"] .attendance-table td.attendance-action-cell,
html[data-theme="dark"] .users-table td.users-action-cell,
html[data-theme="dark"] .offices-table td.offices-action-cell {
  background: #1e293b !important;
}

html[data-theme="dark"] .attendance-table tbody tr:hover td,
html[data-theme="dark"] .attendance-table tbody tr:hover td.attendance-action-cell,
html[data-theme="dark"] .users-table tbody tr:hover td,
html[data-theme="dark"] .users-table tbody tr:hover td.users-action-cell,
html[data-theme="dark"] .offices-table tbody tr:hover td,
html[data-theme="dark"] .offices-table tbody tr:hover td.offices-action-cell,
html[data-theme="dark"] table.custom-table tbody tr:hover td {
  background-color: #263449 !important;
}

html[data-theme="dark"] .attendance-table tbody tr.att-row-selected td {
  background-color: rgba(34, 197, 94, 0.14) !important;
}

html[data-theme="dark"] .wa-submenu-btn {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

html[data-theme="dark"] .wa-submenu-btn:hover {
  background: #1e293b;
  border-color: #475569;
}

html[data-theme="dark"] .wa-submenu-btn.active {
  background: rgba(59, 130, 246, 0.18);
  border-color: #3b82f6;
}

html[data-theme="dark"] .wa-submenu-icon {
  background: #1e293b;
  border-color: #334155;
}

html[data-theme="dark"] .wa-submenu-title {
  color: #f1f5f9;
}

html[data-theme="dark"] .wa-submenu-btn.active .wa-submenu-title {
  color: #93c5fd;
}

html[data-theme="dark"] .action-card-masuk {
  background: rgba(22, 163, 74, 0.15);
  border-color: rgba(34, 197, 94, 0.45);
}

html[data-theme="dark"] .action-card-pulang {
  background: rgba(217, 119, 6, 0.15);
  border-color: rgba(245, 158, 11, 0.45);
}

html[data-theme="dark"] .action-card-kunjungan {
  background: rgba(2, 132, 199, 0.15);
  border-color: rgba(56, 189, 248, 0.45);
}

html[data-theme="dark"] .action-card-izin {
  background: rgba(124, 58, 237, 0.16);
  border-color: rgba(167, 139, 250, 0.45);
}

html[data-theme="dark"] .action-card.action-card-locked {
  background: rgba(220, 38, 38, 0.18);
  border-color: rgba(248, 113, 113, 0.5);
}

html[data-theme="dark"] .tab-count-badge,
html[data-theme="dark"] .quick-week-badge {
  background: #334155;
  color: #e2e8f0;
}

html[data-theme="dark"] .tab-btn.active .tab-count-badge {
  background: rgba(59, 130, 246, 0.28);
  color: #93c5fd;
}

html[data-theme="dark"] .quick-date-pill,
html[data-theme="dark"] .employee-area-chip,
html[data-theme="dark"] .client-tag,
html[data-theme="dark"] .reset-password-toggle {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

html[data-theme="dark"] .quick-date-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

html[data-theme="dark"] .work-area-emp-checklist,
html[data-theme="dark"] .leave-photo-preview-box {
  background: #0f172a;
  border-color: #334155;
}

html[data-theme="dark"] .work-area-emp-item:hover {
  background: #1e293b;
}

html[data-theme="dark"] .work-area-emp-item.is-checked {
  background: rgba(59, 130, 246, 0.2);
}

html[data-theme="dark"] .chat-bubble {
  background-color: rgba(22, 163, 74, 0.18);
  color: #f1f5f9;
  border-left-color: #22c55e;
}

html[data-theme="dark"] .attendance-chat-info,
html[data-theme="dark"] .attendance-bulk-bar {
  background: rgba(22, 163, 74, 0.14);
  border-color: rgba(34, 197, 94, 0.38);
  color: #bbf7d0;
}

html[data-theme="dark"] .attendance-bulk-info {
  color: #bbf7d0;
}

html[data-theme="dark"] .users-template-banner {
  background: rgba(2, 132, 199, 0.15);
  border-color: rgba(56, 189, 248, 0.35);
}

html[data-theme="dark"] .users-template-banner span {
  color: #bae6fd !important;
}

html[data-theme="dark"] .camera-mode-switcher {
  background-color: #0f172a;
  border-color: #334155;
}

html[data-theme="dark"] .camera-mode-btn {
  color: #94a3b8;
}

html[data-theme="dark"] .camera-mode-btn.active {
  background-color: #1e293b;
  color: #60a5fa;
}

html[data-theme="dark"] .stepper-dot {
  background: #334155;
  border-color: #1e293b;
  color: #cbd5e1;
}

html[data-theme="dark"] .checkin-success-card,
html[data-theme="dark"] .login-popup-card {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

html[data-theme="dark"] .checkin-success-title,
html[data-theme="dark"] .checkin-data-value,
html[data-theme="dark"] .text-gray-900 {
  color: #f8fafc !important;
}

html[data-theme="dark"] .checkin-success-subtitle,
html[data-theme="dark"] .login-popup-message,
html[data-theme="dark"] .text-gray-700,
html[data-theme="dark"] .text-gray-600,
html[data-theme="dark"] .text-gray-500 {
  color: #cbd5e1 !important;
}

html[data-theme="dark"] .checkin-motivation-box {
  background: rgba(37, 99, 235, 0.16);
  border-color: rgba(96, 165, 250, 0.35);
}

html[data-theme="dark"] .checkin-motivation-quote {
  color: #e2e8f0;
}

html[data-theme="dark"] .text-blue-600 {
  color: #60a5fa !important;
}

html[data-theme="dark"] .text-green-600 {
  color: #4ade80 !important;
}

html[data-theme="dark"] .text-red-600 {
  color: #f87171 !important;
}

html[data-theme="dark"] .text-purple-600 {
  color: #c084fc !important;
}

/* Penyesuaian elemen dengan inline background terang saat Dark Mode aktif */
html[data-theme="dark"] [style*="background: #f8fafc"],
html[data-theme="dark"] [style*="background:#f8fafc"],
html[data-theme="dark"] [style*="background: #f1f5f9"],
html[data-theme="dark"] [style*="background:#f1f5f9"],
html[data-theme="dark"] [style*="background: #ffffff"],
html[data-theme="dark"] [style*="background:#ffffff"],
html[data-theme="dark"] [style*="background: #fff;"],
html[data-theme="dark"] [style*="background:#fff;"] {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] [style*="color: #0f172a"],
html[data-theme="dark"] [style*="color:#0f172a"],
html[data-theme="dark"] [style*="color: #1e293b"],
html[data-theme="dark"] [style*="color:#1e293b"],
html[data-theme="dark"] [style*="color: #334155"],
html[data-theme="dark"] [style*="color:#334155"] {
  color: #f1f5f9 !important;
}

/* ============================================================
   MENU ASSET (IN / OUT) & KAMERA PART LIVE
   ============================================================ */
.dashboard-main-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

@media (max-width: 720px) {
  .dashboard-main-menu-grid {
    grid-template-columns: 1fr;
  }
}

.asset-submenu-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.asset-submenu-btn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1.5px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: all 0.18s ease;
}

.asset-submenu-btn:hover {
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.asset-submenu-btn.active-in {
  border-color: #16a34a;
  background: #f0fdf4;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.15);
}

.asset-submenu-btn.active-out {
  border-color: #d97706;
  background: #fffbeb;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.16);
}

.asset-submenu-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  background: #f1f5f9;
}

.asset-submenu-btn.active-in .asset-submenu-icon {
  background: #dcfce7;
}

.asset-submenu-btn.active-out .asset-submenu-icon {
  background: #fef3c7;
}

.asset-submenu-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-main);
}

.asset-submenu-desc {
  display: block;
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.3;
}

.asset-tx-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.asset-tx-badge-in {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.asset-tx-badge-out {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}

.asset-live-camera-panel {
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  padding: 0.85rem;
  background: #f8fafc;
}

.asset-camera-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.35rem 0.9rem;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  gap: 0.45rem;
}

.asset-camera-box {
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
  aspect-ratio: 4 / 3;
}

/* Dark Mode untuk Menu Asset (IN / OUT) */
html[data-theme="dark"] .asset-submenu-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

html[data-theme="dark"] .asset-submenu-icon {
  background: #0f172a;
}

html[data-theme="dark"] .asset-submenu-btn.active-in {
  border-color: #22c55e;
  background: rgba(22, 163, 74, 0.16);
}

html[data-theme="dark"] .asset-submenu-btn.active-in .asset-submenu-icon {
  background: rgba(34, 197, 94, 0.25);
}

html[data-theme="dark"] .asset-submenu-btn.active-out {
  border-color: #f59e0b;
  background: rgba(217, 119, 6, 0.16);
}

html[data-theme="dark"] .asset-submenu-btn.active-out .asset-submenu-icon {
  background: rgba(245, 158, 11, 0.25);
}

html[data-theme="dark"] .asset-tx-badge-in {
  background: rgba(22, 163, 74, 0.22);
  color: #86efac;
  border-color: #16a34a;
}

html[data-theme="dark"] .asset-tx-badge-out {
  background: rgba(217, 119, 6, 0.22);
  color: #fde68a;
  border-color: #d97706;
}

html[data-theme="dark"] .asset-live-camera-panel {
  background: #0f172a;
  border-color: #334155;
}

html[data-theme="dark"] .asset-camera-placeholder {
  background: #1e293b;
  border-color: #334155;
}

@media (max-width: 560px) {
  .asset-submenu-nav {
    grid-template-columns: 1fr;
  }
}
