:root[data-theme="light"] {
  --bg: #f1f5f9; --surface: #ffffff; --surface-2: #f8fafc;
  --text: #0f172a; --text-muted: #64748b;
  --primary: #2563eb; --primary-hover: #1d4ed8;
  --success: #16a34a; --warning: #d97706; --danger: #dc2626;
  --border: #e2e8f0;
}
:root[data-theme="dark"] {
  --bg: #0f172a; --surface: #1e293b; --surface-2: #223651;
  --text: #f1f5f9; --text-muted: #94a3b8;
  --primary: #3b82f6; --primary-hover: #60a5fa;
  --success: #22c55e; --warning: #f59e0b; --danger: #ef4444;
  --border: #334155;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  transition: background .3s, color .3s;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }

/* ===== Layout ===== */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px 0; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar h2 {
  padding: 0 20px 20px; font-size: 1.1rem;
  border-bottom: 1px solid var(--border); margin-bottom: 12px;
}
.sidebar h2 span { color: var(--primary); }
.menu { list-style: none; padding: 0 12px; }
.menu li a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 8px;
  color: var(--text); font-size: .92rem;
  transition: .2s; margin-bottom: 2px; text-decoration: none;
}
.menu li a:hover { background: var(--surface-2); }
.menu li a.active { background: var(--primary); color: #fff; }
.main { padding: 24px 32px; }

/* ===== Topbar ===== */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.topbar h1 { font-size: 1.5rem; }
.topbar .actions { display: flex; gap: 10px; align-items: center; }

/* ===== Buttons ===== */
.btn {
  background: var(--primary); color: #fff; border: none;
  padding: 9px 16px; border-radius: 8px; cursor: pointer;
  font-size: .9rem; font-weight: 500; transition: .2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--primary-hover); }
.btn-outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: var(--surface); }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-flex { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn-outline-white { background: transparent; color: #867b7b; border: 2px solid #867b7b; }
.btn-outline-white:hover { background: rgba(255,255,255,.15); }

.theme-toggle {
  background: var(--surface-2); border: 1px solid var(--border);
  width: 40px; height: 34px; border-radius: 8px;
  cursor: pointer; font-size: 1.1rem;
}

/* ===== Cards ===== */
.stats-grid {
  display: grid; gap: 16px; margin-bottom: 24px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px;
}
.stat-card .label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-card .value { font-size: 1.8rem; font-weight: 700; margin: 6px 0; color: var(--primary); }
.stat-card .desc { font-size: .8rem; color: var(--text-muted); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; margin-bottom: 20px;
}

/* ===== Table ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead { background: var(--surface-2); }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); }
tbody tr:hover { background: var(--surface-2); }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: .75rem; font-weight: 600;
}
.badge-success { background: rgba(22,163,74,.15); color: var(--success); }
.badge-warning { background: rgba(217,119,6,.15); color: var(--warning); }
.badge-danger { background: rgba(220,38,38,.15); color: var(--danger); }
.badge-info { background: rgba(37,99,235,.15); color: var(--primary); }

/* ===== Form ===== */
.form-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: .85rem; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); padding: 10px 12px; border-radius: 8px;
  font-size: .9rem; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

/* ===== Auth pages ===== */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: var(--bg);
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px;
  width: 100%; max-width: 420px;
  box-shadow: 0 10px 40px rgba(0,0,0,.06);
}
.auth-card h1 { text-align: center; margin-bottom: 8px; font-size: 1.5rem; }
.auth-card p.sub { text-align: center; color: var(--text-muted); margin-bottom: 28px; font-size: .9rem; }
.auth-card .form-group { margin-bottom: 16px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 12px; }
.auth-card .footer { text-align: center; margin-top: 20px; font-size: .85rem; color: var(--text-muted); }
.auth-card .theme-toggle { position: absolute; top: 20px; right: 20px; }

/* ===== Search bar ===== */
.toolbar {
  display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
  align-items: center;
}
.toolbar input[type="text"] {
  flex: 1; min-width: 200px; padding: 9px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; font-size: .9rem;
}

/* ===== Chart bar (CSS only) ===== */
.chart {
  display: flex; align-items: flex-end; gap: 8px;
  height: 180px; padding: 20px 0;
}
.chart .bar {
  flex: 1; background: var(--primary); border-radius: 4px 4px 0 0;
  position: relative; transition: .3s; min-height: 8px;
}
.chart .bar:hover { background: var(--primary-hover); }
.chart .bar span {
  position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%);
  font-size: .7rem; color: var(--text-muted);
}

@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .main { padding: 16px; }
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px; backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface); border-radius: 16px;
  max-width: 720px; width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 1.15rem; }
.modal-close {
  background: none; border: none; font-size: 1.5rem;
  cursor: pointer; color: var(--text-muted); line-height: 1;
}
.modal-body { padding: 24px; border: 1px solid var(--border); }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 12px; justify-content: flex-end;
}

/* ============ TIMELINE JURNAL ============ */
.timeline { position: relative; padding-left: 40px; }
.timeline::before {
  content: ''; position: absolute; left: 15px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 24px; }
.timeline-dot {
  position: absolute; left: -32px; top: 6px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--primary); border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px var(--primary);
}
.timeline-dot.success { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.timeline-dot.warning { background: var(--warning); box-shadow: 0 0 0 2px var(--warning); }
.timeline-dot.danger  { background: var(--danger);  box-shadow: 0 0 0 2px var(--danger); }
.timeline-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px;
}
.timeline-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 12px;
}
.timeline-date { font-size: .85rem; color: var(--text-muted); }
.timeline-body { font-size: .92rem; line-height: 1.6; }
.timeline-body strong { color: var(--primary); }
.timeline-fotos {
  display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap;
}
.timeline-fotos img {
  width: 100px; height: 100px; object-fit: cover;
  border-radius: 8px; cursor: pointer; border: 1px solid var(--border);
  transition: transform .2s;
}
.timeline-fotos img:hover { transform: scale(1.05); }

/* ============ FOTO UPLOAD MULTI ============ */
.foto-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px; margin-top: 12px;
}
.foto-item {
  position: relative; aspect-ratio: 1;
  border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border);
}
.foto-item img { width: 100%; height: 100%; object-fit: cover; }
.foto-item .hapus {
  position: absolute; top: 6px; right: 6px;
  background: rgba(220,38,38,.9); color: #fff;
  border: none; border-radius: 50%; width: 26px; height: 26px;
  cursor: pointer; font-size: .85rem;
}
.foto-add {
  aspect-ratio: 1; border: 2px dashed var(--border);
  border-radius: 10px; display: flex; align-items: center;
  justify-content: center; cursor: pointer; color: var(--text-muted);
  font-size: .85rem; text-align: center; padding: 8px;
  transition: .2s;
}
.foto-add:hover { border-color: var(--primary); color: var(--primary); }

/* ============ FORM PENILAIAN ============ */
.aspek-group {
  background: var(--surface-2); border-radius: 12px;
  padding: 20px; margin-bottom: 16px;
}
.aspek-group h4 {
  font-size: 1rem; margin-bottom: 16px; color: var(--primary);
  display: flex; align-items: center; gap: 8px;
}
.aspek-row {
  display: grid; grid-template-columns: 1fr 80px;
  gap: 16px; align-items: center; padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.aspek-row:last-child { border-bottom: none; }
.aspek-row label { font-size: .92rem; }
.aspek-row input[type="number"] {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); padding: 8px 10px; border-radius: 8px;
  text-align: center; font-size: .95rem; width: 100%;
}
.nilai-summary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff; padding: 24px; border-radius: 12px;
  text-align: center; margin-bottom: 20px;
  border: 1px solid var(--border);
}
.nilai-summary .big { font-size: 3rem; font-weight: 800; }
.nilai-summary .label { font-size: .9rem; opacity: .9; }
.predikat-badge {
  display: inline-block; padding: 6px 16px; border-radius: 20px;
  background: rgba(255,255,255,.25); font-weight: 700; margin-top: 8px;
}

.detail-table {
  width: 100%;
  margin-bottom: 20px;
  border-collapse: collapse;
}

.detail-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
}

.detail-table .label {
  font-weight: 600;
  width: 30%;
  color: #555;
}

/* ============ BERITA DETAIL ============ */
.artikel-hero {
  width: 100%; height: 250px; object-fit: cover;
  border-radius: 16px; margin-bottom: 24px;
}
.artikel-meta {
  display: flex; gap: 20px; flex-wrap: wrap;
  padding: 16px 0; border-bottom: 1px solid var(--border);
  margin-bottom: 24px; font-size: .9rem; color: var(--text-muted);
}
.artikel-konten {
  font-size: 1.05rem; line-height: 1.8; color: var(--text);
}
.artikel-konten p { margin-bottom: 16px; }
.artikel-konten h2, .artikel-konten h3 {
  margin: 24px 0 12px; color: var(--text);
}
.artikel-konten img {
  max-width: 100%; border-radius: 10px; margin: 16px 0;
}
.artikel-tags { display: flex; gap: 8px; margin: 24px 0; flex-wrap: wrap; }
.artikel-tags span {
  background: var(--surface-2); padding: 6px 14px;
  border-radius: 20px; font-size: .85rem; color: var(--text-muted);
}

/* ============ KOMENTAR ============ */
.komentar-item {
  display: flex; gap: 14px; padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.komentar-item:last-child { border-bottom: none; }
.komentar-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary); color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem;
}
.komentar-body { flex: 1; }
.komentar-body .nama { font-weight: 600; margin-bottom: 4px; }
.komentar-body .waktu { font-size: .8rem; color: var(--text-muted); margin-bottom: 8px; }
.komentar-body .isi { font-size: .95rem; line-height: 1.6; }

/* ============ STAR RATING ============ */
.rating { display: flex; gap: 4px; font-size: 1.3rem; cursor: pointer; }
.rating .star { color: #cbd5e1; transition: .15s; }
.rating .star.active { color: #facc15; }
.rating .star:hover { transform: scale(1.15); }

/* ============ SIDEBAR DINAMIS ============ */
.sidebar .menu-icon {
  font-size: 1.1rem;
  width: 22px;
  display: inline-flex;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar .menu-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar .menu-badge {
  background: var(--danger, #dc2626);
  color: var(--bg);
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}
.sidebar .menu-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 14px;
  opacity: .6;
}
.sidebar .menu a.menu-logout {
  color: var(--danger, #dc2626);
}
.sidebar .menu a.menu-logout:hover {
  background: rgba(220, 38, 38, .1);
}

/* Sub-menu */
.menu-toggle { cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.menu-toggle .arrow { transition: transform 0.3s; font-size: 0.7rem; }
.menu-toggle.open .arrow { transform: rotate(180deg); }
.submenu { display: none; padding-left: 40px; }
.submenu.open { display: block; }
/* ============================================
   RESPONSIVE HEADER & SIDEBAR TOGGLE
   ============================================ */

/* ============ TOPBAR / HEADER ============ */
.topbar {
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 12px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
  transition: background 0.3s;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.topbar-left h1 {
  font-size: 1.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.user-info {
  font-size: 0.9rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ============ HAMBURGER BUTTON ============ */
.hamburger {
  display: none;
  width: 42px;
  height: 42px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  transition: 0.2s;
  flex-shrink: 0;
}

.hamburger:hover {
  background: var(--surface-2);
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: 0.3s;
}

/* Animasi hamburger saat sidebar terbuka */
body.sidebar-open .hamburger span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
body.sidebar-open .hamburger span:nth-child(2) {
  opacity: 0;
}
body.sidebar-open .hamburger span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ============ OVERLAY ============ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.3s;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Sidebar harus di atas overlay */
.sidebar {
  z-index: 101; /* Lebih tinggi dari overlay */
}

/* Overlay menutupi sisa layar */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 100; /* Lebih rendah dari sidebar */
  display: none;
  opacity: 0;
  transition: opacity 0.3s;
}

/* Tampilkan overlay saat body memiliki class sidebar-open */
body.sidebar-open .sidebar-overlay {
  display: block;
  opacity: 1;
}


/* ============ RESPONSIVE BREAKPOINTS ============ */
@media (max-width: 900px) {
  /* Tampilkan hamburger */
  .hamburger {
    display: flex;
  }

  /* Layout jadi 1 kolom */
  .layout {
    grid-template-columns: 1fr !important;
    padding: 0 !important;
    gap: 0 !important;
  }

  /* Sidebar jadi drawer */
  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px !important;
    max-width: 85vw;
    height: 100vh !important;
    /* z-index: 100; */
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    border-radius: 0 !important;
    overflow-y: auto;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  /* Main padding adjust */
  .main {
    padding: 16px !important;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .topbar {
    padding: 8px;
    margin-bottom: 16px;
  }

  .topbar-left h1 {
    font-size: 1.15rem;
  }

  .user-info {
    display: none; /* Sembunyikan di mobile agar hemat ruang */
  }

  /* Grid stats jadi 2 kolom */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .stat-card {
    padding: 14px !important;
  }

  .stat-card .value {
    font-size: 1.4rem !important;
  }

  /* Form grid jadi 1 kolom */
  .form-grid {
    grid-template-columns: 1fr !important;
  }

  /* Tabel scroll horizontal */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 640px;
  }

  /* Card padding */
  .card {
    padding: 16px !important;
  }

  /* Toolbar stack */
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar input[type="text"],
  .toolbar select {
    width: 100%;
  }

  /* Modal fullscreen-ish */
  .modal {
    max-width: 95vw !important;
    max-height: 92vh !important;
    border-radius: 12px !important;
  }

  /* Template picker jadi 1 kolom */
  .template-picker {
    grid-template-columns: 1fr !important;
  }

  .btn-text {
    display: none;
  }
}

/* ============ EXTRA SMALL (Mobile kecil) ============ */
@media (max-width: 480px) {
  /* .stats-grid {
    grid-template-columns: 1fr !important;
  } */

  .topbar-left h1 {
    font-size: 1rem;
  }

  .btn {
    font-size: 0.82rem;
    padding: 8px 14px;
  }

  .theme-toggle {
    width: 35px;
    height: 31px;
    font-size: 0.82rem;
  }

  .container {
    width: 100%;
    justify-self: center;
    place-self: center;

  }
}

/* ============ TOAST NOTIFICATION ============ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  font-size: 0.9rem;
  min-width: 260px;
  max-width: 380px;
  opacity: 0;
  transform: translateX(120%);
  transition:
    opacity 0.3s,
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.toast-success {
  border-left-color: var(--success, #16a34a);
}
.toast-success .toast-icon {
  background: var(--success, #16a34a);
}

.toast-error {
  border-left-color: var(--danger, #dc2626);
}
.toast-error .toast-icon {
  background: var(--danger, #dc2626);
}

.toast-warning {
  border-left-color: var(--warning, #d97706);
}
.toast-warning .toast-icon {
  background: var(--warning, #d97706);
}

.toast-info {
  border-left-color: var(--primary);
}

@media (max-width: 480px) {
  .toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
  }
  .toast {
    min-width: auto;
    max-width: 100%;
  }
}

/* ============ BTN ACTIVE STATE ============ */
.btn-outline.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ============ GPS & ABSENSI ============ */
.gps-status {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 2px solid var(--border);
  transition: .3s;
}

.gps-indicator {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: var(--surface);
  flex-shrink: 0;
}

.gps-indicator.excellent { background: rgba(22,163,74,.15); }
.gps-indicator.good      { background: rgba(22,163,74,.12); }
.gps-indicator.warning   { background: rgba(217,119,6,.15); }
.gps-indicator.invalid   { background: rgba(220,38,38,.15); }

.gps-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--primary);
  animation: gpsPulse 2s ease-out infinite;
}

.gps-indicator.invalid .gps-pulse { border-color: var(--danger); }
.gps-indicator.excellent .gps-pulse { border-color: var(--success); }

@keyframes gpsPulse {
  0%   { transform: scale(1);   opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

.gps-detail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.gps-detail-item {
  background: var(--surface-2);
  padding: 12px;
  border-radius: 10px;
}

.gps-detail-item .label {
  font-size: .75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}

.gps-detail-item .value {
  font-weight: 600;
  font-size: .95rem;
  font-family: 'Courier New', monospace;
}

/* Radius bar */
.radius-track {
  height: 12px;
  background: var(--surface-2);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  margin-top: 8px;
}

.radius-fill {
  height: 100%;
  transition: width .4s ease, background .4s;
  border-radius: 6px;
}

.radius-fill.excellent { background: linear-gradient(90deg,#16a34a,#22c55e); }
.radius-fill.good      { background: linear-gradient(90deg,#22c55e,#84cc16); }
.radius-fill.warning   { background: linear-gradient(90deg,#f59e0b,#facc15); }
.radius-fill.invalid   { background: linear-gradient(90deg,#dc2626,#ef4444); }

/* Grid check-in/out */
.absen-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .absen-grid { grid-template-columns: 1fr; }
}

.absen-box {
  background: var(--surface-2);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  border: 2px solid var(--border);
  transition: .2s;
}

.absen-box:hover { border-color: var(--primary); }

.absen-icon { font-size: 2.5rem; margin-bottom: 8px; }
.absen-box h4 { font-size: 1rem; margin-bottom: 12px; }

.absen-time {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: 'Courier New', monospace;
  color: var(--primary);
  margin-bottom: 6px;
}

.absen-status {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  min-height: 20px;
}

.absen-status.success { color: var(--success); font-weight: 600; }

.btn-block { width: 100%; justify-content: center; padding: 12px; }

/* Camera */
.camera-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Filter select */
.filter-select {
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  font-size: .9rem;
}

/* ============ MODAL EXTRA ============ */
.modal-lg {
  max-width: 900px !important;
}

/* Step indicator */
.step-indicator {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 600;
  margin-right: 6px;
  transition: .2s;
}
.step-indicator.active {
  background: var(--primary);
  color: #fff;
}

/* Modal step (hanya 1 yang tampil) */
.modal-step {
  display: none;
}
.modal-step.active {
  display: block;
  animation: fadeSlideIn .25s ease;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Editor toolbar */
.editor-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  align-items: center;
  flex-wrap: wrap;
}

.editor-toolbar button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .85rem;
  min-width: 36px;
  transition: .15s;
}
.editor-toolbar button:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.editor-area {
  min-height: 240px;
  max-height: 400px;
  overflow-y: auto;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  font-family: inherit;
  font-size: .95rem;
  line-height: 1.7;
  outline: none;
}
.editor-area:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.editor-area:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}
.editor-area ul {
  padding-left: 24px;
  margin: 8px 0;
}

/* Foto cover inline */
.foto-upload-inline {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 16px;
  background: var(--surface-2);
  border-radius: 10px;
  flex-wrap: wrap;
}

.cover-preview {
  width: 240px;
  height: 135px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.foto-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 180px;
}

/* Mobile */
@media (max-width: 768px) {
  .modal-lg {
    max-width: 95vw !important;
  }
  .cover-preview {
    width: 100%;
    height: 180px;
  }
  .foto-upload-inline {
    flex-direction: column;
  }
}

/* ============ MAP CONTAINER ============ */
#mapAbsen {
  height: 320px;
  border-radius: 12px;
  z-index: 1; /* agar di bawah modal */
  border: 1px solid var(--border);
  overflow: hidden;
}

@media (max-width: 768px) {
  #mapAbsen {
    height: 240px;
  }
}

/* Pastikan leaflet container tidak menutupi modal */
.leaflet-container {
  z-index: 1 !important;
  font-family: inherit !important;
}

/* Popup Leaflet lebih clean */
.leaflet-popup-content-wrapper {
  border-radius: 10px;
  padding: 4px;
  font-size: 0.85rem;
}

.leaflet-popup-content b {
  color: var(--primary);
}

/* Marker user animation */
.map-icon-user-pulse {
  animation: userPulse 1.5s ease-out infinite;
}

@keyframes userPulse {
  0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  100% { box-shadow: 0 0 0 20px rgba(239, 68, 68, 0); }
}

