:root {
  --primary: #155e8c;
  --primary-dark: #0e4163;
  --accent: #e8a33d;
  --accent-dark: #c9872a;
  --bg: #f2f5f8;
  --card: #ffffff;
  --text: #1c2733;
  --muted: #6b7a89;
  --border: #dfe6ec;
  --danger: #c0392b;
  --success: #1e8e5a;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(21, 94, 140, 0.08);
  --shadow-lg: 0 8px 26px rgba(21, 94, 140, 0.14);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }

/* ---------- Navigation ---------- */
.navbar {
  top: 0;
  position: sticky;
  z-index: 50;
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-lg);
}
.navbar-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.3px;
  color: #fff;
}
.brand small { display: block; font-weight: 400; font-size: 0.72rem; color: #cfe4f2; }
.nav-links {
  display: flex;
  gap: 4px;
  margin-left: auto;
  align-items: center;
  flex-wrap: wrap;
}
.nav-links a {
  color: #fff;
  padding: 7px 12px;
  border-radius: 20px;
  font-size: 0.92rem;
  opacity: 0.92;
}
.nav-links a.active,
.nav-links a:hover { background: rgba(255, 255, 255, 0.16); opacity: 1; }
.badge-dot {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 12px;
  background: var(--accent);
  color: #1c2733;
  font-weight: 700;
  font-size: 0.78rem;
  margin-left: 4px;
}
.btn-logout {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: none;
  padding: 7px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
}

/* ---------- Layout ---------- */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 18px 16px 60px;
  width: 100%;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 1.35rem; color: var(--primary-dark); }
.page-head p { color: var(--muted); font-size: 0.9rem; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card h3 { margin-bottom: 10px; font-size: 1rem; color: var(--primary-dark); }

.welcome-banner {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 16px;
}
.welcome-banner h1 { font-size: 1.4rem; margin-bottom: 4px; }
.welcome-banner p { opacity: 0.9; font-size: 0.95rem; }

/* ---------- Forms ---------- */
label { display: block; font-size: 0.88rem; font-weight: 600; color: var(--text); margin-bottom: 5px; }
input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  background: #fff;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}
.field { margin-bottom: 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.06s ease, filter 0.15s ease;
  font-family: inherit;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(0.94); }
.btn-accent { background: var(--accent); color: #1c2733; }
.btn-accent:hover { filter: brightness(0.94); }
.btn-ghost { background: #eef2f6; color: var(--primary); }
.btn-ghost:hover { background: #e2e8ee; }
.btn-danger { background: #fbebea; color: var(--danger); }
.btn-danger:hover { background: #f5d8d6; }
.btn-sm { padding: 7px 12px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Alerts ---------- */
.alert {
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 0.92rem;
  display: none;
}
.alert.show { display: block; }
.alert-error { background: #fbebea; color: var(--danger); border: 1px solid #f3c8c5; }
.alert-success { background: #e8f6ee; color: var(--success); border: 1px solid #bfe5d0; }
.alert-info { background: #e8f1f8; color: var(--primary-dark); border: 1px solid #c3dcef; }

/* ---------- Member cards ---------- */
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; }
.check-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 0.88rem; }
.check-item:hover { background: #f2f6fa; }
.check-item input { width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
.check-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.member-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.member-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.member-card .avatar-lg {
  width: 74px; height: 74px;
  border-radius: 50%;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.6rem;
  color: #fff;
  object-fit: cover;
  background: var(--primary);
  user-select: none;
}
.member-card h4 { font-size: 1rem; }
.member-card .sub { color: var(--muted); font-size: 0.85rem; margin-top: 3px; }
.member-card .badge-angkatan {
  display: inline-block;
  margin-top: 8px;
  background: #e8f1f8;
  color: var(--primary-dark);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ---------- Kartu Member PNG ---------- */
.kartu-wrap { display: flex; justify-content: center; margin: 10px 0 18px; }
.kartu {
  width: 360px;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-lg);
  font-family: "Segoe UI", system-ui, sans-serif;
  border: 1px solid var(--border);
}
.kartu-head {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 18px 18px 14px;
}
.kartu-head .org { font-size: 0.75rem; letter-spacing: 1px; opacity: 0.85; text-transform: uppercase; }
.kartu-head h2 { font-size: 1.5rem; letter-spacing: 0.5px; }
.kartu-body { padding: 16px 18px; }
.kartu-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.9rem;
}
.kartu-row:last-child { border-bottom: none; }
.kartu-row .k { color: var(--muted); font-weight: 600; }
.kartu-row .v { text-align: right; font-weight: 600; color: var(--text); word-break: break-word; }
.kartu-avatar {
  width: 84px; height: 84px;
  border-radius: 50%;
  margin: -34px auto 8px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  border: 4px solid #fff;
  user-select: none;
}
.kartu-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.kartu-role {
  text-align: center;
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}

/* ---------- Events ---------- */
.event-item {
  border-left: 4px solid var(--primary);
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.event-item.upcoming { border-left-color: var(--accent); }
.event-item h4 { font-size: 1rem; }
.event-meta { color: var(--muted); font-size: 0.85rem; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.event-desc { margin-top: 6px; color: var(--text); font-size: 0.9rem; }
.reminder-pill {
  display: inline-block;
  background: var(--accent);
  color: #1c2733;
  font-weight: 700;
  font-size: 0.78rem;
  border-radius: 12px;
  padding: 3px 10px;
  margin-top: 8px;
}
.reminder-pill em { font-style: normal; }

/* ---------- Announcements ---------- */
.ann-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.ann-item h4 { font-size: 1rem; }
.ann-body { margin-top: 6px; color: var(--text); font-size: 0.92rem; white-space: pre-wrap; }
.ann-meta { margin-top: 8px; color: var(--muted); font-size: 0.8rem; display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------- Notifications ---------- */
.notif-item {
  display: flex;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.notif-item.unread { border-left: 4px solid var(--accent); }
.notif-ico {
  width: 40px; height: 40px;
  border-radius: 50%;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: #e8f1f8;
}
.notif-item h5 { font-size: 0.95rem; }
.notif-item .when { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.notif-body { color: var(--text); font-size: 0.88rem; margin-top: 4px; }

/* ---------- Modal ---------- */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(14, 65, 99, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}
.modal-bg.show { display: flex; }
.modal {
  background: #fff;
  border-radius: 16px;
  max-width: 520px;
  width: 100%;
  padding: 22px;
  box-shadow: var(--shadow-lg);
  max-height: 88vh;
  overflow-y: auto;
}
.modal h3 { margin-bottom: 14px; color: var(--primary-dark); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ---------- Video ---------- */
.video-box {
  position: relative;
  background: #0e1420;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-box video { width: 100%; height: 100%; object-fit: cover; }
.video-box video.mirror { transform: scaleX(-1); }
.video-placeholder { color: #93a3b5; font-size: 0.95rem; text-align: center; padding: 20px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; width: 100%; }
.tile { position: relative; }
.tile .label {
  position: absolute; left: 8px; top: 8px; z-index: 2;
  background: rgba(10, 20, 30, 0.65); color: #fff;
  padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600;
  pointer-events: none; backdrop-filter: blur(2px);
}
.rtc-state {
  position: absolute; left: 8px; bottom: 8px; z-index: 2;
  background: rgba(10, 20, 30, 0.65); color: #e8eef3;
  padding: 2px 8px; border-radius: 12px; font-size: 0.68rem;
  pointer-events: none; backdrop-filter: blur(2px);
}
.rtc-state.ok { color: #7bd88f; }
.rtc-state.bad { color: #ff8585; }
.vstate { line-height: 1.5; }
.vstate.ok { color: #1d9e4c; font-weight: 600; }
.vstate.bad { color: #d64545; font-weight: 600; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 2px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.table td { padding: 10px 8px; border-bottom: 1px solid var(--border); }
.table tr:hover td { background: #f7fafc; }

/* ---------- Misc ---------- */
.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
}
.chip-blue { background: #e8f1f8; color: var(--primary-dark); }
.chip-green { background: #e8f6ee; color: var(--success); }
.chip-red { background: #fbebea; color: var(--danger); }
.chip-amber { background: #fdf3e1; color: var(--accent-dark); }

.searchbar { margin-bottom: 16px; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 30px 12px;
  font-size: 0.95rem;
}
.spinner {
  width: 22px; height: 22px;
  border: 3px solid #d5e1ea;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.role-tag { text-transform: uppercase; letter-spacing: 0.5px; font-size: 0.7rem; }

.avatar-upload {
  display: flex;
  align-items: center;
  gap: 14px;
}
.avatar-preview {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.4rem;
  overflow: hidden;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grow { flex: 1; }

@media (max-width: 640px) {
  .nav-links { flex-wrap: wrap; }
  .two-col { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 1.15rem; }
  .kartu { width: 100%; max-width: 360px; }
}