:root {
  --navy: #0b2447;
  --navy-dark: #071a33;
  --navy-light: #19376d;
  --accent: #2f6fed;
  --bg: #f4f6fb;
  --white: #ffffff;
  --text: #1c2733;
  --text-muted: #6b7686;
  --border: #e1e6ef;
  --success: #1e8e5a;
  --success-bg: #e7f6ee;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --warning: #b8860b;
  --warning-bg: #fdf3d8;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(11, 36, 71, 0.08), 0 1px 2px rgba(11, 36, 71, 0.06);
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Aptos', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* =====================================================================
   APP SHELL: sidebar (kiri, tetap di desktop) + konten utama
   ===================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #ffffff;
  color: var(--text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  transform: translateX(0);
  transition: transform .25s ease;
  border-right: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--bg);
  padding: 3px;
}
.sidebar-brand .txt {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}
.sidebar-brand .txt small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-user {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-user .name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .role-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--white);
}
.sidebar-user .role-badge.admin { background: var(--danger); }
.sidebar-user .role-badge.user  { background: var(--success); }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 3px;
  transition: background .15s ease, color .15s ease;
}
.sidebar-nav a:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}
.sidebar-nav a.active {
  background: var(--text-muted);
  color: var(--white);
  font-weight: 700;
}
.sidebar-nav .icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}
.sidebar-footer a.logout-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}
.sidebar-footer a.logout-link:hover { color: #a93226; text-decoration: none; }

/* Backdrop untuk mobile ketika sidebar terbuka */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7, 26, 51, 0.55);
  z-index: 190;
}
.sidebar-backdrop.open { display: block; }

/* ---------- Main content area ---------- */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Topbar mobile (hamburger + brand) - hanya tampil di layar kecil */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  background: var(--navy);
  color: var(--white);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 150;
  box-shadow: var(--shadow);
}
.mobile-topbar .hamburger {
  background: rgba(255,255,255,0.12);
  border: none;
  color: var(--white);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
.mobile-topbar .brand {
  font-weight: 700;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Legacy topbar (dipakai di form.php halaman publik tanpa sidebar) ---------- */
.topbar {
  background: var(--navy);
  color: var(--white);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--white);
}
.topbar .brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
}
.topbar nav a {
  color: #cfdcf7;
  margin-left: 20px;
  font-size: 14px;
  font-weight: 500;
}
.topbar nav a:hover { color: var(--white); text-decoration: none; }

/* ---------- Layout / container ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 60px;
  width: 100%;
}

.container.narrow { max-width: 640px; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}
.page-header h1 {
  font-size: 22px;
  margin: 0 0 4px;
  color: var(--navy);
}
.page-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

/* Grid lokasi (dipakai form.php & user dashboard) */
.lokasi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.lokasi-card {
  display: block;
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
  color: var(--text);
}
.lokasi-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(11, 36, 71, 0.12);
  border-left-color: var(--accent);
}
.lokasi-card .badge-top {
  display: inline-block;
  background: #e8eaf6;
  color: var(--navy);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 8px;
}
.lokasi-card .name {
  font-weight: 700;
  color: var(--navy);
  font-size: 15.5px;
  margin-bottom: 4px;
}
.lokasi-card .area {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.lokasi-card .status-line {
  font-size: 12px;
  color: var(--text-muted);
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.lokasi-card .status-line .ada { color: var(--success); font-weight: 700; }
.lokasi-card .status-line .kosong { color: var(--danger); font-weight: 700; }
.lokasi-card .btn-go {
  background: var(--navy);
  color: var(--white);
  text-align: center;
  padding: 9px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
}
.lokasi-card:hover .btn-go { background: var(--navy-light); }

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.empty-state h3 { margin: 0 0 6px; color: var(--text); }

/* ---------- Forms ---------- */
label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}

input[type="text"],
input[type="date"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15);
}

textarea { resize: vertical; min-height: 80px; }

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

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

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.checkbox-group input[type="checkbox"] { width: auto; }
.checkbox-group label { margin: 0; font-weight: 400; cursor: pointer; }

.checkbox-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
  background: #fafbfd;
}
.checkbox-list label {
  font-weight: 400;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  margin: 0;
  border-radius: 4px;
  color: var(--text);
}
.checkbox-list label:hover { background: #e8f0fe; }
.checkbox-list input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--navy); }
.selected-count { font-size: 12px; color: var(--navy); font-weight: 600; margin-top: 4px; }

.file-upload {
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #fafbfd;
  text-align: center;
  cursor: pointer;
}
.file-upload input[type=file] { width: 100%; }
.file-upload .hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.upload-grid .tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  padding: 3px 8px;
  border-radius: 5px;
  margin-bottom: 8px;
  color: var(--white);
}
.tag.before { background: #c0392b; }
.tag.progres { background: #d68910; }
.tag.after { background: #1e8e5a; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
.btn-primary { background: var(--navy); color: var(--white); }
.btn-primary:hover { background: var(--navy-light); text-decoration: none; color: var(--white); }
.btn-outline { background: var(--white); color: var(--navy); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--navy); text-decoration: none; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #a13324; color: var(--white); text-decoration: none; }
.btn-warning { background: #eab308; color: #3a2a00; }
.btn-secondary { background: #6c757d; color: var(--white); }
.btn-secondary:hover { background: #5a6268; color: var(--white); text-decoration: none; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

.btn.loading { opacity: .7; pointer-events: none; }

/* ---------- Alerts / flash ---------- */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 18px;
}
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #c7ecd7; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f5c6bf; }

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.breadcrumb a { color: var(--navy); font-weight: 600; }

/* ---------- Tabel data (laporan / anggota / lokasi) ---------- */
.table-wrap {
  overflow-x: auto;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

table.data-table,
table.laporan {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  font-size: 13px;
}

table.data-table thead th,
table.laporan thead th {
  background: var(--navy);
  color: var(--white);
  padding: 12px 12px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

table.data-table tbody td,
table.laporan tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

table.data-table tbody tr:nth-child(even),
table.laporan tbody tr:nth-child(even) { background: #fafbfd; }
table.data-table tbody tr:hover,
table.laporan tbody tr:hover { background: #f0f4ff; }

.doc-thumbs { display: flex; gap: 6px; }
.doc-thumbs figure { margin: 0; text-align: center; width: 60px; }
.doc-thumbs img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: zoom-in;
}
.doc-thumbs figcaption {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .03em;
  margin-top: 3px;
  color: var(--text-muted);
}

.action-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  text-decoration: none;
}

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 18px;
}
.filter-bar .field { flex: 1 1 160px; }
.filter-bar .field.small { flex: 0 1 120px; }
.filter-bar label { margin-bottom: 5px; }
.filter-bar .actions { display: flex; gap: 8px; }

/* ---------- Stat cards ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.stat-card .num { font-size: 26px; font-weight: 700; color: var(--navy); }
.stat-card .label { font-size: 12px; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Pagination ---------- */
.pagination-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: var(--radius);
  margin-top: 15px;
  flex-wrap: wrap;
  gap: 10px;
}
.pagination-info { font-size: 13px; color: var(--text-muted); }
.pagination-links { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination-links a,
.pagination-links span {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 500;
}
.pagination-links a:hover { background: #eaf1ff; text-decoration: none; }
.pagination-links .active { background: var(--navy); color: var(--white); border-color: var(--navy); }
.pagination-links .disabled { color: #ccc; pointer-events: none; background: #f8f9fa; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  background: #eaf1ff;
  color: var(--navy);
}
.badge-role,
.badge-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--white);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge-role.admin { background: var(--danger); }
.badge-role.user  { background: var(--success); }
.badge-status.aktif { background: var(--success-bg); color: var(--success); }
.badge-status.nonaktif { background: var(--danger-bg); color: var(--danger); }

/* ---------- Login page ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--navy-dark), var(--navy) 60%);
  padding: 20px;
}
.login-card {
  background: var(--white);
  border-radius: 14px;
  padding: 34px 30px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}
.login-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin: 0 auto 12px;
}
.login-card h1 {
  font-size: 19px;
  color: var(--navy);
  margin: 0 0 4px;
  text-align: center;
}
.login-card p.sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 22px;
}

/* ---------- Modal lightbox ---------- */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7, 26, 51, 0.85);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 30px;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: min(90vw, 700px);
  max-height: 85vh;
  border-radius: 8px;
}
.lightbox .close-btn {
  position: absolute;
  top: 20px; right: 26px;
  color: var(--white);
  font-size: 28px;
  cursor: pointer;
  background: none;
  border: none;
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
  padding: 24px 0;
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */

/* Tablet ke bawah: sidebar jadi off-canvas drawer, topbar mobile muncul */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 8px 0 24px rgba(0,0,0,0.25);
  }
  .sidebar.open { transform: translateX(0); }

  .main-wrap { margin-left: 0; }

  .mobile-topbar { display: flex; }

  .container { padding: 20px 16px 50px; }
}

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .upload-grid { grid-template-columns: 1fr; }
  .checkbox-list { grid-template-columns: 1fr; }
  .lokasi-grid { grid-template-columns: 1fr; }

  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header .page-actions { width: 100%; }
  .page-header .page-actions .btn { width: 100%; }

  .stats-row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

  table.data-table,
  table.laporan { min-width: 640px; }

  .pagination-wrapper { flex-direction: column; align-items: stretch; text-align: center; }
  .pagination-links { justify-content: center; }
}

@media (max-width: 480px) {
  .container { padding: 16px 12px 40px; }
  .login-card { padding: 26px 20px; }
}
