:root {
  --bg: #f7f7f5;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --border: #e3e3e0;
  --accent: #2f6f4f;
  --accent-dark: #244f39;
  --danger: #b3261e;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 18px 60px;
}

.wrap.wide { max-width: 900px; }

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

nav a { color: var(--text); text-decoration: none; font-weight: 600; }
nav .links a { margin-left: 16px; font-weight: 400; color: var(--muted); }

h1 { font-size: 1.5rem; margin: 0 0 6px; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; }
p.lead { color: var(--muted); margin-top: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
}

label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 0.9rem; }

input[type=email], input[type=password], input[type=text], select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  font-family: inherit;
}

button, .btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin-top: 16px;
}
button:hover, .btn:hover { background: var(--accent-dark); }
.btn.secondary { background: var(--muted); }
.btn.small { padding: 6px 10px; font-size: 0.85rem; margin-top: 0; }

.error { color: var(--danger); font-size: 0.9rem; margin-top: 10px; }
.success { color: var(--accent-dark); background: #eaf4ee; border: 1px solid #cfe6d8; padding: 12px 14px; border-radius: 8px; margin-top: 14px; }

table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }

.stat-row { display: flex; gap: 12px; flex-wrap: wrap; }
.stat {
  flex: 1;
  min-width: 130px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat .num { font-size: 1.8rem; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 0.85rem; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge.active { background: #eaf4ee; color: var(--accent-dark); }
.badge.pending { background: #fdf2e3; color: #92600a; }
.badge.invited { background: #e8eefc; color: #1d4ed8; }
.badge.disabled { background: #f1f1f1; color: var(--muted); }

.qr-box { text-align: center; }
.qr-box img { max-width: 100%; width: 360px; height: 360px; border: 1px solid var(--border); border-radius: 8px; }
.countdown { color: var(--muted); font-size: 0.9rem; margin-top: 10px; }

/* ---- Member dashboard shell (sidebar layout) ---- */

.icon { width: 18px; height: 18px; flex-shrink: 0; }

.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-icon { font-size: 1.4rem; line-height: 1; }
.brand-name { font-weight: 700; font-size: 0.95rem; }
.brand-sub { color: var(--muted); font-size: 0.78rem; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 12px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.nav-item:hover { background: #f1f1ef; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item.active .icon { color: #fff; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 14px 16px;
}
.sidebar-user { margin-bottom: 10px; }
.su-name { font-weight: 700; font-size: 0.88rem; }
.su-email { color: var(--muted); font-size: 0.78rem; word-break: break-all; }
.logout-btn { color: var(--danger); padding-left: 0; margin-top: 0; }
.logout-btn:hover { background: none; text-decoration: underline; }

.main-col { flex: 1; min-width: 0; }

.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.hamburger { background: none; border: none; font-size: 1.3rem; cursor: pointer; padding: 4px; }
.topbar-brand-mobile { font-weight: 700; }

.content {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 14px;
}

/* Member ID chip on the profile page, e.g. AUNZ00001 */
.member-code {
  display: inline-block;
  background: #f1f1ef;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.quick-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.quick-link {
  flex: 1;
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}
.quick-link:hover { border-color: var(--accent); }
.quick-link .icon { color: var(--accent); width: 20px; height: 20px; }

.field-row { display: flex; gap: 24px; flex-wrap: wrap; }
.field { min-width: 140px; }
.field .field-label { color: var(--muted); font-size: 0.8rem; margin-bottom: 2px; }
.field .field-value { font-weight: 600; }

/* Kegiatan / Riwayat Hadir list rows */
.section-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 24px 0 10px;
}
.section-label:first-child { margin-top: 0; }

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.list-row-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.list-row-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #eaf4ee;
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}
.list-row-icon .icon { width: 18px; height: 18px; }
.list-row-title { font-weight: 600; font-size: 0.94rem; }
.list-row-sub { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
.list-row-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.status-pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-pill.hadir { background: #eaf4ee; color: var(--accent-dark); }
.status-pill.izin { background: #e8eefc; color: #1d4ed8; }

.empty-note { color: var(--muted); font-size: 0.9rem; padding: 8px 0 4px; }

/* ---- Scan QR page ---- */
.scanner-frame {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  background: #111;
  border-radius: var(--radius);
  overflow: hidden;
}
.scanner-frame video, .scanner-frame canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scanner-frame .viewfinder {
  position: absolute;
  inset: 15%;
  border: 3px solid rgba(255,255,255,0.7);
  border-radius: 12px;
  pointer-events: none;
}
.scan-status { text-align: center; margin-top: 14px; color: var(--muted); font-size: 0.92rem; min-height: 1.4em; }
.scan-status.error { color: var(--danger); }
.scan-status.success { color: var(--accent-dark); font-weight: 600; }

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 20;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar { display: flex; }
  .content { padding: 24px 16px 50px; }
}
