:root {
  --bg: #080c14;
  --surface: rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --text: #e8edf5;
  --text-muted: #6b7a91;
  --accent: #3b8bff;
  --accent-glow: rgba(59,139,255,0.25);
  --accent-dim: rgba(59,139,255,0.12);
  --red: #ff4d4d;
  --red-dim: rgba(255,77,77,0.12);
  --green: #34d399;
  --green-dim: rgba(52,211,153,0.12);
  --yellow: #fbbf24;
  --yellow-dim: rgba(251,191,36,0.12);
  --purple: #a78bfa;
  --purple-dim: rgba(167,139,250,0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --font: 'DM Sans', sans-serif;
  --font-display: 'Bebas Neue', sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(59,139,255,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 90% 80%, rgba(167,139,250,0.05) 0%, transparent 60%);
}

/* ── Auth / Setup Pages ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 40px 36px;
  backdrop-filter: blur(20px);
  box-shadow: 0 32px 64px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.03) inset;
}

.auth-logo {
  font-family: var(--font-display);
  font-size: 2.2rem;
  letter-spacing: 0.04em;
  color: var(--text);
  margin-bottom: 4px;
}

.auth-logo span { color: var(--accent); }

.auth-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 32px;
}

.auth-step { display: none; }
.auth-step.active { display: block; }

.step-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.step-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ── Form Elements ── */
label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 7px;
  font-weight: 500;
}

input[type=text], input[type=number], input[type=password],
input[type=url], input[type=datetime-local], textarea, select {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.92rem;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }

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

select option { background: #141a24; }

.field { margin-bottom: 18px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* PIN input */
.pin-input {
  font-size: 1.6rem !important;
  letter-spacing: 0.5em;
  text-align: center;
  font-family: 'Courier New', monospace !important;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.18s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover { background: #5aa0ff; box-shadow: 0 6px 24px var(--accent-glow); }

.btn-ghost {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--border-strong); background: rgba(255,255,255,0.08); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(255,77,77,0.2);
}
.btn-danger:hover { background: rgba(255,77,77,0.2); }

.btn-sm { padding: 7px 13px; font-size: 0.8rem; }
.btn-full { width: 100%; }

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Dashboard Layout ── */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,0.015);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0.05em;
  padding: 0 8px;
  margin-bottom: 32px;
  color: var(--text);
}
.sidebar-logo span { color: var(--accent); }

.nav-section {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0 8px;
  margin-bottom: 8px;
  margin-top: 20px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  transition: all 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--surface-hover); }
.nav-link.active { color: var(--accent); background: var(--accent-dim); }

.nav-link svg { width: 16px; height: 16px; opacity: 0.8; flex-shrink: 0; }

.sidebar-spacer { flex: 1; }

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

.user-name { font-size: 0.83rem; font-weight: 500; }
.user-role { font-size: 0.72rem; color: var(--text-muted); }

/* ── Main content ── */
.main {
  flex: 1;
  padding: 36px 40px;
  max-width: 960px;
}

.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  letter-spacing: 0.03em;
  line-height: 1;
  margin-bottom: 6px;
}

.page-desc { color: var(--text-muted); font-size: 0.88rem; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-title { font-weight: 600; font-size: 0.95rem; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-meet { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(59,139,255,0.2); }
.badge-announcement { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(251,191,36,0.2); }
.badge-update { background: var(--green-dim); color: var(--green); border: 1px solid rgba(52,211,153,0.2); }
.badge-information { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(167,139,250,0.2); }
.badge-superuser { background: var(--accent-dim); color: var(--accent); }

/* ── Event list item ── */
.item-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.item-row:last-child { border-bottom: none; padding-bottom: 0; }
.item-row:first-child { padding-top: 0; }

.item-body { flex: 1; min-width: 0; }
.item-name { font-weight: 600; font-size: 0.93rem; margin-bottom: 4px; }
.item-detail { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; }
.item-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }

.item-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Roster card ── */
.member-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.member-photo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  background: var(--surface-hover);
}

.member-initials {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
}

/* ── Modal ── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-backdrop.open { display: flex; }

.modal {
  width: 100%;
  max-width: 480px;
  background: #0e1520;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6);
}

.modal-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.modal-desc { font-size: 0.83rem; color: var(--text-muted); margin-bottom: 24px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: #1a2235;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 0.85rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 999;
  max-width: 320px;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { border-left: 3px solid var(--green); }
#toast.error { border-left: 3px solid var(--red); }

/* ── Invite link box ── */
.invite-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 12px;
  word-break: break-all;
}
.invite-link { flex: 1; font-size: 0.78rem; color: var(--accent); font-family: monospace; }

/* ── Auth menu sheet ── */
.sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
}
.sheet-backdrop.open { display: block; }

.sheet {
  position: fixed;
  bottom: 0; right: 0;
  width: 340px;
  background: #0e1520;
  border: 1px solid var(--border-strong);
  border-radius: 20px 20px 0 0;
  padding: 24px;
  z-index: 101;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.sheet.open { transform: translateY(0); }

.sheet-title { font-size: 1rem; font-weight: 600; margin-bottom: 16px; }
.sheet-divider { height: 1px; background: var(--border); margin: 12px 0; }

/* ── Misc ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 0.88rem; }

.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 28px;
  width: fit-content;
}

.tab {
  padding: 7px 18px;
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  transition: all 0.15s;
}
.tab.active { background: var(--surface-hover); color: var(--text); border: 1px solid var(--border-strong); }

.section { display: none; }
.section.active { display: block; }

@media (max-width: 700px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 16px; gap: 8px; }
  .main { padding: 20px 16px; }
  .field-row { grid-template-columns: 1fr; }
  .sheet { width: 100%; border-radius: 20px 20px 0 0; }
}
