:root {
  --teal: #0d9488;
  --teal-dark: #0f766e;
  --teal-darker: #134e4a;
  --topbar: #0e3f3b;
  --bg: #f2f6f5;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1f2937;
  --muted: #6b7280;
  --green: #059669;
  --red: #dc2626;
  --amber: #d97706;
  --blue: #2563eb;
  --purple: #7c3aed;
  --gray: #6b7280;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

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

/* ---------- Topbar (navbar atas) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #0e3f3b 0%, #0d9488 100%);
  color: #fff;
  height: 60px;
  padding: 0 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.topbar-brand {
  color: #fff; font-size: 18px; font-weight: 700;
  text-decoration: none; display: flex; align-items: center; gap: 6px;
}
.topbar-nav { display: flex; align-items: center; gap: 2px; }
.topbar-nav a {
  color: #e0f2f1; text-decoration: none;
  padding: 8px 13px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.topbar-nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.topbar-nav a.active { background: rgba(255,255,255,.22); color: #fff; font-weight: 600; }
.topbar-nav a.logout-link { color: #ffd7d7; }
.hamburger { display: none; }

/* ---------- Main ---------- */
.main { max-width: 1100px; margin: 0 auto; padding: 24px 20px 48px; }

.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 22px; color: var(--teal-darker); }

.section { margin-bottom: 28px; }
.section-title {
  font-size: 15px; font-weight: 700; color: var(--teal-darker);
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 2px solid var(--teal);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, #0e3f3b 0%, #0d9488 60%, #10b981 100%);
  color: #fff;
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: 0 6px 20px rgba(13,148,136,.25);
}
.hero h1 { font-size: 22px; margin-bottom: 4px; }
.hero p { opacity: .92; font-size: 14px; }

/* ---------- Stats ---------- */
.stats { display: flex; gap: 14px; flex-wrap: wrap; }
.stat {
  flex: 1; min-width: 170px;
  background: var(--card);
  border: none;
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
  display: flex; flex-direction: column; gap: 5px;
}
.stat-icon { font-size: 26px; line-height: 1; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 800; letter-spacing: -.2px; }

.stat-teal  { background: linear-gradient(135deg, #0d9488, #14b8a6); color: #fff; }
.stat-green { background: linear-gradient(135deg, #059669, #10b981); color: #fff; }
.stat-red   { background: linear-gradient(135deg, #dc2626, #ef4444); color: #fff; }
.stat-blue  { background: linear-gradient(135deg, #2563eb, #3b82f6); color: #fff; }
.stat-amber { background: linear-gradient(135deg, #d97706, #f59e0b); color: #fff; }
.stat-purple{ background: linear-gradient(135deg, #6d28d9, #8b5cf6); color: #fff; }
.stat-gray  { background: linear-gradient(135deg, #4b5563, #6b7280); color: #fff; }
.stat-teal .stat-label, .stat-green .stat-label, .stat-red .stat-label,
.stat-blue .stat-label, .stat-amber .stat-label, .stat-purple .stat-label,
.stat-gray .stat-label { color: rgba(255,255,255,.85); }

.c-green { color: var(--green); }
.c-red { color: var(--red); }
.c-amber { color: var(--amber); }
.c-blue { color: var(--blue); }
.c-gray { color: var(--gray); }

/* ---------- Progress ---------- */
.progress { height: 10px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress-bar { height: 100%; background: var(--amber); border-radius: 999px; transition: width .3s; }
.progress-bar.full { background: var(--green); }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }

/* ---------- Tables ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.table th { background: #f0fdfa; color: var(--teal-darker); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.table tbody tr:hover { background: #f8fbfa; }
.table tr:last-child td { border-bottom: none; }
.ta-right { text-align: right; }
.ta-center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; }
.empty { padding: 22px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); font-size: 12.5px; }
.mt { margin-top: 12px; }
small { font-size: 12px; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-gray { background: #e5e7eb; color: #374151; }

/* ---------- Forms ---------- */
.form-card { margin-bottom: 20px; }
.form-card.compact { padding: 14px 18px; }
.form-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; color: var(--teal-darker); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 16px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; }
.label { font-size: 12.5px; font-weight: 600; color: #374151; }
.req { color: var(--red); }
.input {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: #fff; color: var(--text); width: 100%;
}
.input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,148,136,.15); }
.form-actions { display: flex; gap: 10px; }

.radio-group { display: flex; gap: 16px; align-items: center; padding: 8px 0; }
.radio { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: all .15s; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-outline { background: #fff; color: var(--teal); border-color: var(--teal); }
.btn-outline:hover { background: #f0fdfa; }
.btn-ghost { background: #fff; color: #374151; border-color: var(--border); }
.btn-ghost:hover { background: #f3f4f6; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-block { width: 100%; }

/* ---------- Toolbar / filter ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-form .input { width: auto; min-width: 150px; }

/* ---------- Actions ---------- */
.actions { white-space: nowrap; }
.actions a, .actions button { margin: 0 2px; }
.inline-form { display: inline; }
.link-danger { background: none; border: none; color: var(--red); cursor: pointer; font-size: 14px; padding: 0; }

/* ---------- Flash ---------- */
.flash { padding: 11px 15px; border-radius: 9px; margin-bottom: 16px; font-size: 13.5px; }
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flash ul { margin-left: 18px; }

/* ---------- Jamaah head ---------- */
.jamaah-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.jamaah-head h2 { font-size: 20px; color: var(--teal-darker); }
.jamaah-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; color: #374151; font-size: 13.5px; }
.jamaah-meta a { font-weight: 600; }
.jamaah-head-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin-bottom: 8px; }
.timeline-item { display: flex; gap: 14px; margin-bottom: 14px; }
.timeline-dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--teal); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.timeline-body { flex: 1; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
.timeline-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.timeline-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.timeline-actions { margin-top: 8px; display: flex; gap: 14px; font-size: 13px; }

/* ---------- Jalan list ---------- */
.jalan-list { display: flex; flex-direction: column; gap: 12px; }
.jalan-item { display: block; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; color: var(--text); }
.jalan-item:hover { border-color: var(--teal); text-decoration: none; }
.jalan-item-top { display: flex; gap: 8px; margin-bottom: 6px; }
.jalan-item-title { font-weight: 700; font-size: 15px; }
.jalan-item-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; color: var(--muted); font-size: 13px; }

/* ---------- Report cards ---------- */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 26px; }
.report-card { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; color: var(--text); }
.report-card:hover { border-color: var(--teal); text-decoration: none; }
.report-icon { font-size: 30px; }
.report-title { font-weight: 700; }
.report-desc { color: var(--muted); font-size: 12.5px; }

/* ---------- Login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(160deg, #0e3f3b, #0d9488); padding: 20px; }
.login-card {
  background: #fff; border-radius: 16px; padding: 36px 32px;
  width: 100%; max-width: 380px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-brand { font-size: 44px; }
.login-card h1 { font-size: 22px; color: var(--teal-darker); margin-top: 8px; }
.login-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.login-hint { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form .label { text-align: left; }
.otp-input { text-align: center; font-size: 26px; letter-spacing: 10px; font-weight: 700; }

/* ---------- Responsive (mobile) ---------- */
@media (max-width: 900px) {
  .hamburger {
    display: block; background: none; border: none;
    color: #fff; font-size: 26px; cursor: pointer; padding: 4px 8px; line-height: 1;
  }
  .topbar-nav {
    display: none;
    position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 30px rgba(0,0,0,.2);
    padding: 8px;
  }
  .topbar-nav.open { display: flex; }
  .topbar-nav a { color: var(--text); padding: 12px 16px; font-size: 15px; }
  .topbar-nav a:hover { background: #f0fdfa; }
  .topbar-nav a.active { background: var(--teal); color: #fff; }
  .topbar-nav a.logout-link { color: var(--red); }

  .main { padding: 16px 14px 40px; }
  .page-head h1 { font-size: 19px; }

  .stats { gap: 10px; }
  .stat { min-width: calc(50% - 5px); flex: 1 1 45%; padding: 12px 14px; }
  .stat-value { font-size: 17px; }

  .jamaah-head { flex-direction: column; }
  .jamaah-head-actions { width: 100%; flex-wrap: wrap; }
  .jamaah-head-actions .btn { flex: 1 1 auto; text-align: center; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar > .btn { text-align: center; }
  .filter-form { flex-direction: column; }
  .filter-form .input { width: 100%; min-width: 0; }
  .filter-form .btn { width: 100%; text-align: center; }

  .form-grid { grid-template-columns: 1fr; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1; text-align: center; }

  .table th, .table td { padding: 9px 8px; font-size: 12.5px; }

  .timeline-meta { flex-direction: column; gap: 4px; }
  .jalan-item-meta { flex-direction: column; gap: 4px; }
}

/* Fallback deteksi perangkat sentuh (class is-mobile via JS) */
html.is-mobile .hamburger { display: block; }
html.is-mobile .topbar-nav {
  display: none;
  position: absolute; top: 60px; left: 0; right: 0;
  flex-direction: column; align-items: stretch;
  background: #fff; border-bottom: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(0,0,0,.2); padding: 8px;
}
html.is-mobile .topbar-nav.open { display: flex; }
html.is-mobile .topbar-nav a { color: var(--text); padding: 12px 16px; font-size: 15px; }
html.is-mobile .topbar-nav a.active { background: var(--teal); color: #fff; }
html.is-mobile .topbar-nav a.logout-link { color: var(--red); }
html.is-mobile .main { padding: 16px 14px 40px; }
html.is-mobile .stats { gap: 10px; }
html.is-mobile .stat { min-width: calc(50% - 5px); flex: 1 1 45%; padding: 12px 14px; }
html.is-mobile .stat-value { font-size: 17px; }
html.is-mobile .jamaah-head { flex-direction: column; }
html.is-mobile .jamaah-head-actions { width: 100%; flex-wrap: wrap; }
html.is-mobile .jamaah-head-actions .btn { flex: 1 1 auto; text-align: center; }
html.is-mobile .toolbar { flex-direction: column; align-items: stretch; }
html.is-mobile .filter-form { flex-direction: column; }
html.is-mobile .filter-form .input { width: 100%; min-width: 0; }
html.is-mobile .form-grid { grid-template-columns: 1fr; }
html.is-mobile .form-actions .btn { flex: 1; text-align: center; }
