/* ============================================
   WHENWE - Group Planning App
   Design System: Clean & Geometric
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,300&family=DM+Mono:wght@400;500&display=swap');

/* ── CSS Variables ─────────────────────────── */
:root {
  --bg: #f5f4f0;
  --bg-card: #ffffff;
  --bg-hover: #f0efe9;
  --bg-input: #f5f4f0;
  --border: #e2e0d8;
  --border-focus: #2d6a4f;

  --text-primary: #1a1a18;
  --text-secondary: #6b6b60;
  --text-muted: #9b9b8c;
  --text-inverse: #ffffff;

  --accent: #2d6a4f;
  --accent-light: #e8f5ee;
  --accent-dark: #1b4332;
  --accent-hover: #245e44;

  --available: #2d6a4f;
  --available-bg: #d8f3dc;
  --partial: #f9c74f;
  --partial-bg: #fff8e1;
  --unavailable: #e63946;
  --unavailable-bg: #ffe5e7;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.06);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --font: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;

  --transition: 0.18s ease;
  --transition-slow: 0.3s ease;

  --sidebar-width: 260px;
  --topbar-height: 64px;
}

[data-theme="dark"] {
  --bg: #111110;
  --bg-card: #1c1c1a;
  --bg-hover: #252523;
  --bg-input: #252523;
  --border: #2e2e2b;
  --border-focus: #52b788;

  --text-primary: #f0efe9;
  --text-secondary: #a0a090;
  --text-muted: #666658;
  --text-inverse: #111110;

  --accent: #52b788;
  --accent-light: #1b3a2d;
  --accent-dark: #74c69d;
  --accent-hover: #40a373;

  --available: #52b788;
  --available-bg: #1b3a2d;
  --partial: #f9c74f;
  --partial-bg: #3a2e10;
  --unavailable: #ff6b6b;
  --unavailable-bg: #3a1a1a;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
}

/* ── Reset & Base ──────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition-slow), color var(--transition-slow);
  -webkit-font-smoothing: antialiased;
}

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

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

ul, ol { list-style: none; }

input, textarea, select, button { font-family: var(--font); }

/* ── Typography ────────────────────────────── */
h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
h3 { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; }
h4 { font-size: 0.95rem; font-weight: 600; }
p  { font-size: 0.95rem; }

.text-sm   { font-size: 0.82rem; }
.text-xs   { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

/* ── Layout ────────────────────────────────── */
.page { display: none; min-height: 100vh; }
.page.active { display: flex; }

/* Auth pages */
.auth-page {
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 2rem;
  gap: 2rem;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}

.auth-logo .logo-dot {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-logo .logo-dot svg { color: white; }

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
}

.auth-card h2 { margin-bottom: 0.5rem; }
.auth-card .subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 2rem; }

/* App layout */
.app-layout {
  flex-direction: row;
  width: 100%;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-slow);
}

.sidebar-header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.logo-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-mark svg { width: 16px; height: 16px; color: white; }

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  margin-top: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.user-pill:hover { background: var(--bg-hover); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar.sm { width: 26px; height: 26px; font-size: 0.65rem; }
.avatar.lg { width: 40px; height: 40px; font-size: 0.875rem; }

.user-info { flex: 1; overflow: hidden; }
.user-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Main content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-title { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
.topbar-subtitle { font-size: 0.8rem; color: var(--text-muted); }

.topbar-right { display: flex; align-items: center; gap: 0.625rem; }

.content-body {
  flex: 1;
  padding: 2rem 1.75rem;
  max-width: 1100px;
  width: 100%;
}

/* ── Buttons ───────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  background: var(--unavailable);
  color: white;
  border-color: var(--unavailable);
}
.btn-danger:hover:not(:disabled) { opacity: 0.85; }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }
.btn-full { width: 100%; }
.btn-icon { padding: 0.5rem; border-radius: var(--radius-sm); }

/* ── Forms ─────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
  letter-spacing: 0.01em;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.12);
}

[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-textarea:focus {
  box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.15);
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.35rem; }
.form-error { font-size: 0.78rem; color: var(--unavailable); margin-top: 0.35rem; }

/* Toggle / Checkbox */
.toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.toggle-chip {
  padding: 0.375rem 0.875rem;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.toggle-chip:hover { border-color: var(--accent); color: var(--accent); }
.toggle-chip.selected { background: var(--accent); border-color: var(--accent); color: white; }

/* ── Cards ─────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-sm { padding: 1rem 1.25rem; border-radius: var(--radius-md); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ── Badge ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-green  { background: var(--available-bg);   color: var(--available); }
.badge-red    { background: var(--unavailable-bg); color: var(--unavailable); }
.badge-yellow { background: var(--partial-bg);     color: #b5830a; }
.badge-gray   { background: var(--bg-hover);       color: var(--text-muted); }
.badge-blue   { background: #e0f0ff; color: #1a6aaa; }

[data-theme="dark"] .badge-blue { background: #1a2e3a; color: #5bafd6; }
[data-theme="dark"] .badge-yellow { color: var(--partial); }

/* ── Modal ─────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(0.98);
  transition: transform var(--transition-slow);
}

.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-title { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.02em; }
.modal-subtitle { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.2rem; }

.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ── Toast ─────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--text-primary);
  color: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.125rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  max-width: 320px;
  pointer-events: all;
  animation: toast-in 0.25s ease;
}

.toast.success { background: var(--available); }
.toast.error   { background: var(--unavailable); }
.toast.warning { background: #d97706; }

@keyframes toast-in {
  from { transform: translateX(100%) scale(0.95); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}

@keyframes toast-out {
  from { transform: translateX(0) scale(1); opacity: 1; }
  to   { transform: translateX(100%) scale(0.95); opacity: 0; }
}

/* ── Dashboard Grid ────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.group-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.group-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.group-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.group-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.group-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.member-stack {
  display: flex;
  align-items: center;
}

.member-stack .avatar { margin-right: -6px; border: 2px solid var(--bg-card); }
.member-stack .avatar:last-child { margin-right: 0; }

/* ── Availability Calendar ─────────────────── */
.availability-legend {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.calendar-grid-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.calendar-grid {
  min-width: 700px;
}

.calendar-header-row {
  display: grid;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
}

.calendar-header-cell {
  padding: 0.625rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.calendar-row {
  display: grid;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.calendar-row:last-child { border-bottom: none; }
.calendar-row:hover { background: var(--bg-hover); }

.calendar-date-cell {
  padding: 0.75rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  border-right: 1px solid var(--border);
  min-width: 90px;
}

.calendar-date-cell .day-name {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.calendar-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.25rem;
  cursor: pointer;
  transition: all var(--transition);
  border-right: 1px solid var(--border);
  position: relative;
}

.calendar-slot:last-child { border-right: none; }

.slot-indicator {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  transition: all var(--transition);
  border: 2px solid transparent;
}

.slot-indicator.none {
  background: var(--bg-input);
  color: var(--text-muted);
  border-color: var(--border);
}

.slot-indicator.available {
  background: var(--available-bg);
  color: var(--available);
  border-color: var(--available);
}

.slot-indicator.maybe {
  background: var(--partial-bg);
  color: #b5830a;
  border-color: var(--partial);
}

.slot-indicator:hover { transform: scale(1.1); }
.calendar-slot:hover .slot-indicator.none { border-color: var(--available); color: var(--available); }

/* Analysis heatmap */
.heatmap-cell {
  width: 100%;
  height: 100%;
  min-height: 44px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  transition: all var(--transition);
}

.heatmap-cell.score-0   { background: var(--bg-input); color: var(--text-muted); }
.heatmap-cell.score-low { background: #ffe5e7; color: #e63946; }
.heatmap-cell.score-mid { background: #fff8e1; color: #b5830a; }
.heatmap-cell.score-high { background: #d8f3dc; color: #2d6a4f; }
.heatmap-cell.score-full { background: #2d6a4f; color: white; }

[data-theme="dark"] .heatmap-cell.score-low  { background: #3a1a1a; color: #ff6b6b; }
[data-theme="dark"] .heatmap-cell.score-mid  { background: #3a2e10; color: var(--partial); }
[data-theme="dark"] .heatmap-cell.score-high { background: #1b3a2d; color: #52b788; }
[data-theme="dark"] .heatmap-cell.score-full { background: #2d6a4f; color: white; }

/* Best days list */
.best-days-list { display: flex; flex-direction: column; gap: 0.625rem; }

.best-day-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.best-day-item:hover { border-color: var(--accent); }

.best-day-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--accent-light);
  color: var(--accent);
}

.best-day-rank.rank-1 { background: #fff8e1; color: #b5830a; }
.best-day-rank.rank-2 { background: #f0f0f0; color: #666; }
.best-day-rank.rank-3 { background: #fff0e8; color: #c45c26; }

[data-theme="dark"] .best-day-rank.rank-1 { background: #3a2e10; }
[data-theme="dark"] .best-day-rank.rank-2 { background: #252523; }
[data-theme="dark"] .best-day-rank.rank-3 { background: #3a2010; }

.best-day-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--bg-hover);
  border-radius: 100px;
  overflow: hidden;
}

.best-day-bar {
  height: 100%;
  border-radius: 100px;
  background: var(--accent);
  transition: width 0.6s ease;
}

.best-day-score {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 36px;
  text-align: right;
}

/* ── Member list ───────────────────────────── */
.member-list { display: flex; flex-direction: column; gap: 0.5rem; }

.member-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  transition: background var(--transition);
}

.member-item:hover { background: var(--bg-hover); }

.member-item-info { flex: 1; overflow: hidden; }
.member-item-name { font-size: 0.875rem; font-weight: 600; }
.member-item-email { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Invitation items */
.invite-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
}

.invite-item-info { flex: 1; }
.invite-item-group { font-size: 0.875rem; font-weight: 600; }
.invite-item-from { font-size: 0.75rem; color: var(--text-secondary); }
.invite-actions { display: flex; gap: 0.5rem; }

/* ── Activities ────────────────────────────── */
.activity-list { display: flex; flex-direction: column; gap: 0.75rem; }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.activity-item:hover { border-color: var(--accent); }

.activity-date-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 48px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.activity-date-badge .month { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; color: var(--accent); letter-spacing: 0.05em; }
.activity-date-badge .day { font-size: 1.25rem; font-weight: 700; color: var(--accent); line-height: 1; }

.activity-info { flex: 1; }
.activity-name { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.2rem; }
.activity-desc { font-size: 0.8rem; color: var(--text-secondary); }

/* ── Tabs ──────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 1.75rem;
}

.tab-btn {
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn .badge { font-size: 0.65rem; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Utility ───────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  gap: 0.75rem;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  background: var(--bg-hover);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.empty-state-icon svg { width: 26px; height: 26px; color: var(--text-muted); }
.empty-state h3 { font-size: 0.95rem; font-weight: 600; }
.empty-state p { font-size: 0.82rem; color: var(--text-muted); max-width: 240px; }

.inline-error {
  padding: 0.75rem 1rem;
  background: var(--unavailable-bg);
  color: var(--unavailable);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid rgba(230, 57, 70, 0.25);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-title { font-size: 0.85rem; font-weight: 700; letter-spacing: -0.01em; color: var(--text-secondary); }

/* Theme toggle button */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1.5px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  color: var(--text-secondary);
}

.theme-toggle:hover { background: var(--bg-card); color: var(--text-primary); }
.theme-toggle svg { width: 17px; height: 17px; }

/* Mobile menu toggle */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1.5px solid var(--border);
  cursor: pointer;
  color: var(--text-primary);
}

.sidebar-close-btn { display: none; }

/* Progress bar */
.progress-wrap { height: 6px; background: var(--bg-hover); border-radius: 100px; overflow: hidden; margin-top: 0.75rem; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 100px; transition: width 0.5s ease; }

/* ── Responsive ────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-width: 280px; }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
  }

  .mobile-menu-btn { display: flex; }

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

  .content-body { padding: 1.25rem 1rem; }

  .topbar { padding: 0 1rem; }

  .groups-grid { grid-template-columns: 1fr; }

  .auth-card { padding: 1.75rem; }

  h1 { font-size: 1.5rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .modal { padding: 1.5rem; }
}

/* ── Animations ────────────────────────────── */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-in { animation: fade-in 0.25s ease both; }

.stagger > * { animation: fade-in 0.25s ease both; }
.stagger > *:nth-child(1) { animation-delay: 0.0s; }
.stagger > *:nth-child(2) { animation-delay: 0.05s; }
.stagger > *:nth-child(3) { animation-delay: 0.10s; }
.stagger > *:nth-child(4) { animation-delay: 0.15s; }
.stagger > *:nth-child(5) { animation-delay: 0.20s; }
.stagger > *:nth-child(6) { animation-delay: 0.25s; }

/* Settings page */
.settings-section { margin-bottom: 2rem; }
.settings-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.danger-zone {
  border: 1.5px solid var(--unavailable);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}

/* Color override for availability dots in group view */
.availability-summary-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
