/* ============================================
   REVIVING MY IMAN — CONTENT ORGANIZER
   Design System & Complete Styles
   ============================================ */

:root {
  --bg: #fafaf9;
  --surface: #fff;
  --surface-hover: #f5f5f4;
  --text-primary: #1c1917;
  --text-secondary: #78716c;
  --text-tertiary: #a8a29e;
  --border: #e7e5e4;
  --border-light: #f5f5f4;
  --book1: #fef3c7; --book1-text: #92400e; --book1-border: #fcd34d;
  --book2: #d1fae5; --book2-text: #065f46; --book2-border: #6ee7b7;
  --fr: #dbeafe; --fr-text: #1e40af;
  --en: #ffedd5; --en-text: #c2410c;
  --de: #dcfce7; --de-text: #166534;
  --mouad-accent: #2563eb;
  --mouad-light: #eff6ff;
  --fati-accent: #7c3aed;
  --fati-light: #f5f3ff;
  --muslima-bg: #fef3c7; --muslima-text: #92400e;
  --jannah-fr-bg: #d1fae5; --jannah-fr-text: #065f46;
  --jannah-en-bg: #f3e8ff; --jannah-en-text: #6b21a8;
  --iman-bg: #dbeafe; --iman-text: #1e40af;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.08);
  --shadow-xl: 0 24px 60px rgba(0,0,0,.1);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --ease: cubic-bezier(.16,1,.3,1);
}

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100dvh;
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
}

/* ============================================
   SCREENS & TRANSITIONS
   ============================================ */
.screen { display: none; min-height: 100dvh; }
.screen.active { display: flex; flex-direction: column; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* ============================================
   LOGIN / PROFILE SCREEN
   ============================================ */
#login-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  position: relative;
}

.profile-bg-glow {
  position: fixed;
  width: 600px; height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: .15;
  pointer-events: none;
  z-index: 0;
}
.glow-1 { background: #2563eb; top: -200px; left: -100px; }
.glow-2 { background: #7c3aed; bottom: -200px; right: -100px; }

.profile-header {
  text-align: center;
  margin-bottom: 48px;
  position: relative;
  z-index: 1;
}
.profile-logo { margin-bottom: 16px; color: var(--text-primary); }
.profile-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 8px;
}
.profile-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 400;
}

.profile-cards {
  display: flex;
  gap: 24px;
  position: relative;
  z-index: 1;
}

.profile-card {
  width: 280px;
  padding: 40px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  text-align: center;
  cursor: pointer;
  transition: all .4s var(--ease);
  position: relative;
  overflow: hidden;
}
.profile-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
  border-color: transparent;
}
.profile-card[data-profile="mouad"]:hover { box-shadow: 0 24px 60px rgba(37,99,235,.15); }
.profile-card[data-profile="fati"]:hover { box-shadow: 0 24px 60px rgba(124,58,237,.15); }

.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
}
.mouad-avatar { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.fati-avatar { background: linear-gradient(135deg, #7c3aed, #8b5cf6); }

.profile-name { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.profile-info { font-size: 14px; color: var(--text-secondary); }

/* Login Steps */
.login-step { width: 100%; display: flex; flex-direction: column; align-items: center; }
.login-step.hidden { display: none; }

.google-signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 32px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all .2s var(--ease);
  box-shadow: var(--shadow-md);
}
.google-signin-btn:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}
.google-signin-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}
.google-signin-btn svg { flex-shrink: 0; }

.signin-hint {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.signed-in-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}
.signed-in-photo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.signed-in-as {
  text-align: center;
  margin-bottom: 24px;
}

/* ============================================
   TOP BAR
   ============================================ */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250,250,249,.98);
  /* backdrop-filter removed for mobile perf */
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.top-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 60px;
  gap: 16px;
}
.top-bar-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.top-bar-logo-svg { width: 22px; height: 22px; vertical-align: middle; margin-right: 8px; stroke: var(--text-primary); }

.back-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s ease;
  color: var(--text-primary);
  flex-shrink: 0;
}
.back-btn:hover { background: var(--surface-hover); }

.profile-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}
.profile-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.profile-dot.mouad { background: var(--mouad-accent); }
.profile-dot.fati { background: var(--fati-accent); }

/* ============================================
   HOME SCREEN
   ============================================ */
.home-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 100px;
  width: 100%;
}

.home-greeting {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 20px;
}

.home-today-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px 24px;
  margin-bottom: 32px;
  cursor: pointer;
  transition: all .3s var(--ease);
}
.home-today-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.home-today-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.home-today-svg { width: 20px; height: 20px; stroke: var(--text-secondary); flex-shrink: 0; }
.home-today-title { font-weight: 600; font-size: 15px; }
.home-today-arrow { margin-left: auto; color: var(--text-tertiary); font-size: 18px; }
.home-today-summary {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.home-sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.section-card-wide {
  grid-column: 1 / -1;
}

.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px;
  cursor: pointer;
  transition: all .3s var(--ease);
}
.section-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: transparent;
}
.section-icon { margin-bottom: 14px; }
.section-icon svg { width: 28px; height: 28px; stroke: var(--text-secondary); }
.section-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.section-desc { font-size: 13px; color: var(--text-secondary); }

/* ============================================
   BOTTOM NAV (Mobile)
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 200;
  background: rgba(240,238,236,.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: none;
  display: none;
  padding: 8px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  align-items: flex-end;
}
.bottom-nav::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(0,0,0,.08);
  z-index: 10;
}
.bottom-nav.visible {
  display: flex;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 4px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .2s ease;
  color: var(--text-tertiary);
  font-family: inherit;
}
.nav-btn.active { color: var(--text-primary); }
.nav-btn.active .nav-svg { stroke-width: 2.2; }
.nav-svg { width: 24px; height: 24px; transition: all .2s var(--ease); stroke: currentColor; }
.nav-label { font-size: 11px; font-weight: 500; }

/* Message badge on nav icon */
.nav-icon-wrap {
  position: relative;
  display: inline-flex;
}
.msg-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 4px rgba(239,68,68,.4);
}
.msg-badge.hidden { display: none; }

/* Message badge inline (home card) */
.msg-badge-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  margin-left: 6px;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.msg-badge-inline.hidden { display: none; }

/* Center "Today" button — raised & rounded */
.nav-btn.nav-btn-center {
  position: relative;
  margin-top: -18px;
  padding-top: 0;
}
.nav-center-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--text-primary), #555);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  transition: all .25s var(--ease);
}
.nav-btn.nav-btn-center.active .nav-center-circle {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 4px 20px rgba(37,99,235,.35);
}
body[data-profile="fati"] .nav-btn.nav-btn-center.active .nav-center-circle {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  box-shadow: 0 4px 20px rgba(124,58,237,.35);
}
.nav-svg-center {
  width: 24px;
  height: 24px;
  stroke: #fff;
  transition: all .2s var(--ease);
}
.nav-btn.nav-btn-center .nav-label {
  margin-top: 4px;
}

/* ============================================
   SECTION CONTENT
   ============================================ */
.section-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 100px;
  width: 100%;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* ============================================
   BUTTONS
   ============================================ */
.primary-btn {
  padding: 10px 20px;
  border-radius: 100px;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .25s var(--ease);
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
}
.mouad .primary-btn, body[data-profile="mouad"] .primary-btn { background: var(--mouad-accent); }
.fati .primary-btn, body[data-profile="fati"] .primary-btn { background: var(--fati-accent); }
.primary-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

.secondary-btn {
  padding: 10px 20px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s ease;
  color: var(--text-primary);
}
.secondary-btn:hover { background: var(--surface-hover); }

/* ============================================
   FILTER PILLS
   ============================================ */
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-pill {
  padding: 7px 16px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .25s ease;
  font-family: inherit;
  color: var(--text-secondary);
}
.filter-pill:hover { background: var(--surface-hover); }
body[data-profile="mouad"] .filter-pill.active { background: var(--mouad-accent); color: #fff; border-color: var(--mouad-accent); }
body[data-profile="fati"] .filter-pill.active { background: var(--fati-accent); color: #fff; border-color: var(--fati-accent); }

/* ============================================
   DAY PILLS (Schedule)
   ============================================ */
.day-pills-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 16px;
  margin-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.day-pills-container::-webkit-scrollbar { display: none; }

.day-pill {
  padding: 10px 20px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .25s ease;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--text-primary);
}
.day-pill:hover { background: var(--surface-hover); }
body[data-profile="mouad"] .day-pill.active { background: var(--mouad-accent); color: #fff; border-color: var(--mouad-accent); }
body[data-profile="fati"] .day-pill.active { background: var(--fati-accent); color: #fff; border-color: var(--fati-accent); }

/* ============================================
   VIEW TOGGLE
   ============================================ */
.view-toggle-wrap { display: flex; justify-content: center; margin-bottom: 16px; }
.view-toggle {
  display: inline-flex;
  background: var(--surface-hover);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid var(--border);
}
.view-btn {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-secondary);
  transition: all .2s ease;
}
.view-btn.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ============================================
   SCHEDULE: ROUNDS GRID
   ============================================ */
.rounds-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.round-col {
  padding: 20px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.6);
  box-shadow: 0 4px 24px rgba(0,0,0,.04), inset 0 1px 0 rgba(255,255,255,.8);
}
.round-1-glass {
  background: linear-gradient(135deg, rgba(219,234,254,.55), rgba(191,219,254,.45), rgba(224,231,255,.15));
}
.round-2-glass {
  background: linear-gradient(135deg, rgba(209,250,229,.35), rgba(167,243,208,.2), rgba(187,247,208,.15));
}

.round-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.round-badge {
  font-size: 14px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 100px;
  background: rgba(255,255,255,.7);
  
}
.round-time { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

.posts-list { display: flex; flex-direction: column; gap: 8px; }

.post-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,.65);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.5);
  
  transition: all .2s ease;
}
.post-card:hover { background: rgba(255,255,255,.85); }

.post-time {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.post-account {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}
.post-flag { font-size: 15px; }

.content-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  white-space: nowrap;
  min-width: 80px;
  text-align: center;
}
.content-badge.jannah-fr { background: var(--jannah-fr-bg); color: var(--jannah-fr-text); }
.content-badge.jannah-en { background: var(--jannah-en-bg); color: var(--jannah-en-text); }
.content-badge.iman { background: var(--iman-bg); color: var(--iman-text); }
.content-badge.muslima { background: var(--muslima-bg); color: var(--muslima-text); }

.schedule-sub-view { display: none; }
.schedule-sub-view.active { display: block; }

/* ============================================
   ANALYTICS (Schedule)
   ============================================ */
.analytics-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  transition: all .2s ease;
}
.stat-card:hover { box-shadow: var(--shadow-sm); }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -1px; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-top: 4px; }

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

.analytics-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.analytics-card-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.reminder-count-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
}
.reminder-count-row:not(:last-child) { border-bottom: 1px solid var(--border-light); }
.reminder-count-value { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============================================
   IDEAS
   ============================================ */
.ideas-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.idea-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all .3s var(--ease);
  cursor: pointer;
}
.idea-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.idea-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.idea-indicators {
  display: flex;
  gap: 6px;
  align-items: center;
}
.idea-indicator {
  font-size: 11px;
  color: var(--text-tertiary);
  background: var(--surface-hover);
  padding: 2px 8px;
  border-radius: 100px;
  font-weight: 500;
}
.idea-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  cursor: pointer;
  transition: all .2s ease;
}
.idea-status.new { background: #dbeafe; color: #1e40af; }
.idea-status.used { background: #d1fae5; color: #065f46; }
.idea-text {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 12px;
}
.idea-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Idea Detail View */
.idea-detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.idea-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.idea-detail-date {
  font-size: 13px;
  color: var(--text-tertiary);
}
.idea-detail-text {
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: 24px;
  white-space: pre-wrap;
}
.idea-detail-section {
  margin-bottom: 24px;
}
.idea-detail-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}
.idea-detail-accounts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.idea-detail-account {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.idea-detail-flag { font-size: 18px; }
.idea-detail-acc-name { font-size: 14px; font-weight: 500; }
.idea-detail-acc-lang { font-size: 12px; color: var(--text-tertiary); }
.idea-detail-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.idea-detail-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform .2s ease;
  border: 1px solid var(--border);
}
.idea-detail-img:hover { transform: scale(1.03); }
.idea-detail-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.idea-detail-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-primary);
  font-size: 13px;
  transition: all .2s ease;
  word-break: break-all;
}
.idea-detail-link:hover { background: #eff6ff; border-color: #93c5fd; }
.idea-detail-link-icon { font-size: 16px; flex-shrink: 0; }
.idea-detail-link span:nth-child(2) { flex: 1; }
.idea-detail-link-arrow { color: var(--text-tertiary); flex-shrink: 0; }
.idea-detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* Danger button */
.danger-btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid #fecaca;
  background: #fff;
  color: #dc2626;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s ease;
}
.danger-btn:hover { background: #fef2f2; }

/* Idea form image upload */
.idea-image-upload {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.idea-image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.idea-preview-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
}
.upload-btn-small {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: var(--surface-hover);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .2s ease;
  width: fit-content;
}
.upload-btn-small:hover { background: var(--border-light); border-color: var(--text-tertiary); }

/* ============================================
   STYLE GUIDE
   ============================================ */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.account-grid-section {
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.account-grid-section:not(:first-child) { margin-top: 8px; }

.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all .3s var(--ease);
}
.account-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.account-card-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.account-card-lang { font-size: 13px; color: var(--text-secondary); }

.styleguide-detail.hidden { display: none; }

.sg-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: 16px;
  padding: 6px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all .2s ease;
}
.sg-back-link:hover { background: var(--surface-hover); }

.sg-detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
}
.sg-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.sg-detail-name { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.sg-detail-lang {
  font-size: 13px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 100px;
}

.sg-description {
  margin-bottom: 24px;
}
.sg-description label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.sg-description textarea {
  width: 100%;
  min-height: 120px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  background: var(--bg);
  color: var(--text-primary);
  transition: border-color .2s ease;
}
.sg-description textarea:focus { outline: none; border-color: var(--text-tertiary); }

.sg-images { margin-bottom: 16px; }
.sg-images label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.sg-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.sg-image-thumb {
  aspect-ratio: 9/16;
  border-radius: var(--radius-sm);
  object-fit: cover;
  width: 100%;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .2s ease;
}
.sg-image-thumb:hover { box-shadow: var(--shadow-md); }

.sg-upload-btn {
  aspect-ratio: 9/16;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 13px;
  transition: all .2s ease;
  background: var(--bg);
}
.sg-upload-btn:hover { border-color: var(--text-tertiary); color: var(--text-secondary); }
.sg-upload-icon { font-size: 28px; }

.sg-save-row {
  display: flex;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

/* ============================================
   PERFORMANCE TRACKER
   ============================================ */
.tracker-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tracker-filters select {
  padding: 8px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  appearance: auto;
}

.tracker-table-wrap { overflow-x: auto; }
.tracker-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tracker-table th {
  text-align: left;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.tracker-table th:hover { color: var(--text-primary); }
.tracker-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.tracker-table tr:hover td { background: var(--surface-hover); }
.tracker-table .views-cell { font-weight: 600; font-variant-numeric: tabular-nums; }
.tracker-table .link-cell a {
  color: var(--mouad-accent);
  text-decoration: none;
  font-size: 12px;
}
.tracker-table .link-cell a:hover { text-decoration: underline; }

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
}

/* Dashboard 2-column rows — desktop only */
.dash-row {
  display: flex;
  gap: 16px;
  margin-bottom: 0;
}
.dash-col {
  flex: 1;
  min-width: 0;
}

@media (max-width: 768px) {
  .dash-row {
    flex-direction: column;
    gap: 0;
  }
}

.dashboard-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}
.dash-section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}

.dash-ranking { display: flex; flex-direction: column; gap: 8px; }
.dash-rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.dash-rank-pos {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.dash-rank-pos.gold { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.dash-rank-pos.silver { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }
.dash-rank-pos.bronze { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.dash-rank-name { font-size: 14px; font-weight: 500; flex: 1; }
.dash-rank-value { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

.lang-comparison {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.lang-card {
  padding: 16px;
  border-radius: var(--radius-sm);
  text-align: center;
}
.lang-card.fr { background: var(--fr); color: var(--fr-text); }
.lang-card.en { background: var(--en); color: var(--en-text); }
.lang-card.de { background: var(--de); color: var(--de-text); }
.lang-card-flag { font-size: 24px; margin-bottom: 6px; }
.lang-card-value { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.lang-card-label { font-size: 11px; font-weight: 500; margin-top: 2px; opacity: .8; }

.chart-container {
  position: relative;
  height: 220px;
}

.dashboard-empty { text-align: center; padding: 60px 20px; }

/* ============================================
   NOTES THREAD
   ============================================ */
.notes-search-bar {
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-light);
}
.notes-search-bar input {
  width: 100%;
  padding: 10px 16px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color .2s ease;
}
.notes-search-bar input:focus { outline: none; border-color: var(--text-tertiary); }

.notes-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
}

/* Current user's messages — always right */
.note-bubble.note-me {
  align-self: flex-end;
  border-bottom-right-radius: 6px;
}
.note-bubble.note-me.sender-mouad {
  background: linear-gradient(135deg, rgba(219,234,254,.85), rgba(191,219,254,.7));
  border: 1px solid rgba(37,99,235,.15);
}
.note-bubble.note-me.sender-fati {
  background: linear-gradient(135deg, rgba(243,232,255,.85), rgba(233,213,255,.7));
  border: 1px solid rgba(124,58,237,.15);
}
/* Other user's messages — always left */
.note-bubble.note-other {
  align-self: flex-start;
  border-bottom-left-radius: 6px;
}
.note-bubble.note-other.sender-mouad {
  background: linear-gradient(135deg, rgba(219,234,254,.55), rgba(191,219,254,.45));
  border: 1px solid rgba(37,99,235,.1);
}
.note-bubble.note-other.sender-fati {
  background: linear-gradient(135deg, rgba(243,232,255,.55), rgba(233,213,255,.45));
  border: 1px solid rgba(124,58,237,.1);
}

.note-sender {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
  opacity: .7;
}
.note-text { word-break: break-word; }
.note-text .account-tag {
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0,0,0,.06);
}
.note-audio-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 8px 0 4px;
  background: rgba(0,0,0,.04);
  border-radius: 24px;
  min-width: 200px;
}
.audio-play-btn {
  width: 36px; height: 36px;
  min-width: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s ease;
  color: var(--text-primary);
}
.audio-play-btn:hover { background: rgba(0,0,0,.14); }
.note-audio-player.playing .audio-play-btn {
  background: var(--mouad-accent);
  color: #fff;
}
body[data-profile="fati"] .note-audio-player.playing .audio-play-btn {
  background: var(--fati-accent);
}
.audio-play-btn .hidden { display: none; }
.audio-wave-wrap {
  flex: 1;
  height: 32px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  border-radius: 4px;
}
.audio-wave-bars {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 100%;
  padding: 2px 0;
}
.audio-wave-bar {
  flex: 1;
  background: rgba(0,0,0,.15);
  border-radius: 2px;
  min-width: 3px;
  transition: background .15s ease;
}
.note-audio-player.playing .audio-wave-bar {
  background: rgba(0,0,0,.12);
}
.audio-progress {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: 4px;
}
.audio-progress::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--mouad-accent);
  opacity: .25;
}
body[data-profile="fati"] .audio-progress::after {
  background: var(--fati-accent);
}
/* Color played bars */
.note-audio-player .audio-wave-wrap {
  position: relative;
}
.audio-time {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  min-width: 32px;
  text-align: right;
}
.note-time {
  font-size: 10px;
  color: var(--text-tertiary);
}
.note-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}
.note-bubble.note-other .note-meta {
  justify-content: flex-start;
}
.note-read {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-tertiary);
}
.note-read.read {
  color: #2563eb;
}
body[data-profile="fati"] .note-read.read {
  color: #7c3aed;
}
.note-link {
  color: #2563eb;
  text-decoration: underline;
  word-break: break-all;
  font-size: 13px;
}
body[data-profile="fati"] .note-link {
  color: #7c3aed;
}
.added-by-cell {
  font-size: 12px;
  white-space: nowrap;
}

/* Reply preview bar above input */
.reply-preview {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: rgba(0,0,0,.03);
  border-radius: 12px;
  border-left: 3px solid #2563eb;
  gap: 10px;
}
body[data-profile="fati"] .reply-preview {
  border-left-color: #7c3aed;
}
.reply-preview.hidden { display: none; }
.reply-preview-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.reply-preview-sender {
  font-size: 12px;
  font-weight: 600;
  color: #2563eb;
  margin-bottom: 2px;
}
body[data-profile="fati"] .reply-preview-sender {
  color: #7c3aed;
}
.reply-preview-text {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-preview-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

/* Reply quote inside message bubble */
.reply-quote {
  padding: 6px 10px;
  margin-bottom: 6px;
  border-radius: 8px;
  background: rgba(0,0,0,.05);
  border-left: 3px solid #2563eb;
  cursor: pointer;
}
body[data-profile="fati"] .reply-quote {
  border-left-color: #7c3aed;
}
.reply-quote-sender {
  font-size: 11px;
  font-weight: 600;
  color: #2563eb;
  margin-bottom: 2px;
}
body[data-profile="fati"] .reply-quote-sender {
  color: #7c3aed;
}
.reply-quote-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* Highlight animation when scrolling to referenced message */
.note-highlight {
  animation: msgHighlight 1.5s ease;
}
@keyframes msgHighlight {
  0%, 100% { box-shadow: none; }
  30% { box-shadow: 0 0 0 3px rgba(37,99,235,.4); }
  70% { box-shadow: 0 0 0 3px rgba(37,99,235,.2); }
}
body[data-profile="fati"] .note-highlight {
  animation-name: msgHighlightFati;
}
@keyframes msgHighlightFati {
  0%, 100% { box-shadow: none; }
  30% { box-shadow: 0 0 0 3px rgba(124,58,237,.4); }
  70% { box-shadow: 0 0 0 3px rgba(124,58,237,.2); }
}

.at-autocomplete {
  position: fixed;
  bottom: 155px;
  left: 24px;
  right: 24px;
  max-width: 400px;
  background: rgba(255,255,255,.97);
  
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 250;
  max-height: 240px;
  overflow-y: auto;
}
.at-autocomplete.hidden { display: none; }
.at-option {
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .15s ease;
}
.at-option:hover { background: var(--surface-hover); }

.notes-input-bar {
  position: sticky;
  bottom: 0;
  padding: 12px 24px;
  padding-bottom: max(96px, calc(86px + env(safe-area-inset-bottom)));
  background: rgba(250,250,249,.98);
  
  border-top: 1px solid var(--border);
}
.notes-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 8px 8px 8px 16px;
}
.notes-input-wrap textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  max-height: 100px;
  padding: 6px 0;
  background: transparent;
  color: var(--text-primary);
}
.notes-input-actions { display: flex; gap: 4px; }
.notes-action-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-secondary);
  transition: all .2s ease;
}
.notes-action-btn:hover { background: var(--surface-hover); }
.send-btn { color: var(--mouad-accent); }
body[data-profile="fati"] .send-btn { color: var(--fati-accent); }

.mic-btn.recording {
  background: #fee2e2;
  color: #dc2626;
  animation: pulse 1.5s ease infinite;
}

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin-top: 8px;
}
.recording-indicator.hidden { display: none; }
.recording-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #dc2626;
  animation: pulse 1s ease infinite;
}
.recording-timer { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.recording-stop {
  margin-left: auto;
  padding: 6px 16px;
  border-radius: 100px;
  border: 1px solid #fecaca;
  background: #fee2e2;
  color: #dc2626;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.active { display: flex; }

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: scaleIn .3s var(--ease) both;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 0;
}
.modal-header h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--surface-hover);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all .2s ease;
}
.modal-close:hover { background: var(--border); }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  transition: border-color .2s ease;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--text-tertiary); }

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

.account-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.account-chip {
  padding: 6px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s ease;
  user-select: none;
}
.account-chip:hover { background: var(--surface-hover); }
.account-chip.selected {
  border-color: var(--mouad-accent);
  background: var(--mouad-light);
  color: var(--mouad-accent);
}
body[data-profile="fati"] .account-chip.selected {
  border-color: var(--fati-accent);
  background: var(--fati-light);
  color: var(--fati-accent);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.empty-sub { font-size: 13px; color: var(--text-secondary); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
  .rounds-grid { grid-template-columns: 1fr; }
  .lang-comparison { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .profile-cards { flex-direction: column; gap: 16px; align-items: center; }
  .profile-card { width: 100%; max-width: 320px; }
  .home-greeting { font-size: 20px; }
  .home-sections-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .section-card { padding: 20px 16px; }
  .section-icon svg { width: 22px; height: 22px; }
  .section-name { font-size: 14px; }
  .section-desc { font-size: 12px; }
  .top-bar-inner { padding: 0; }
  .form-row { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: 1fr 1fr; }
  .note-bubble { max-width: 88%; }
  .modal-card { border-radius: 20px; }
  .tracker-table { font-size: 12px; }
  .tracker-table th, .tracker-table td { padding: 10px 8px; }
  .dashboard-stats { grid-template-columns: 1fr 1fr; }
}

/* PWA standalone mode — add safe area padding at top */
@media all and (display-mode: standalone) {
  .top-bar {
    padding-top: env(safe-area-inset-top);
  }
  #login-screen {
    padding-top: env(safe-area-inset-top);
  }
  .bottom-nav {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
}

/* Profile menu (top bar) */
.profile-menu-wrap {
  position: relative;
}
.profile-menu-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-menu-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.profile-menu-fallback {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}
.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
  z-index: 500;
  overflow: hidden;
}
.profile-dropdown.hidden { display: none; }
.profile-dropdown-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.dropdown-header-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.dropdown-header-email {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-dropdown-items {
  padding: 6px;
}
.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  transition: background .15s;
}
.profile-dropdown-item:hover {
  background: rgba(0,0,0,.04);
}
.profile-dropdown-item.logout {
  color: #dc2626;
}
.profile-dropdown-item.logout svg {
  stroke: #dc2626;
}

/* Hide bottom nav on desktop */
@media (min-width: 769px) {
  .bottom-nav { display: none !important; }
  .section-content { padding-bottom: 40px; }
  .home-content { padding-bottom: 40px; }
  .notes-input-bar { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

/* Notes screen needs special layout */
#notes-screen.active {
  height: 100dvh;
  overflow: hidden;
}
#notes-screen .notes-messages {
  flex: 1;
  overflow-y: auto;
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-primary);
  color: #fff;
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  z-index: 400;
  opacity: 0;
  transition: all .3s var(--ease);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================
   DETAIL POPUP
============================================ */
.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.popup-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.popup-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  position: relative;
  transform: translateY(20px) scale(.96);
  transition: transform .3s var(--ease);
}
.popup-overlay.active .popup-card {
  transform: translateY(0) scale(1);
}
.popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-tertiary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s ease;
}
.popup-close:hover { background: var(--surface-hover); color: var(--text-primary); }

.popup-header-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}
.popup-flag { font-size: 36px; }
.popup-account-name { font-size: 18px; font-weight: 600; }
.popup-account-lang { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.popup-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.popup-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.popup-info-item { }
.popup-info-full { grid-column: 1 / -1; }
.popup-info-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}
.popup-info-value {
  font-size: 15px;
  font-weight: 500;
}
.popup-views {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}
.popup-link {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
}
.popup-link:hover { text-decoration: underline; }

.popup-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

.post-card { cursor: pointer; }
.post-card:active { transform: scale(0.98); }

tr[onclick]:hover { background: var(--surface-hover); }

/* ============================================
   TEAM PERFORMANCE
============================================ */
.team-comparison {
  padding: 4px 0;
}
.team-cards {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.team-card {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.team-card.mouad-team { border-top: 3px solid var(--mouad-accent); }
.team-card.fati-team { border-top: 3px solid var(--fati-accent); }
.team-card-avatar { font-size: 28px; margin-bottom: 6px; }
.team-card-name { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.team-card-views { font-size: 24px; font-weight: 700; }
.team-card-label { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.team-vs {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.team-bar-wrap { margin-top: 4px; }
.team-bar {
  display: flex;
  height: 10px;
  border-radius: 100px;
  overflow: hidden;
  background: var(--surface-hover);
}
.team-bar-mouad {
  background: var(--mouad-accent);
  transition: width .5s var(--ease);
  border-radius: 100px 0 0 100px;
}
.team-bar-fati {
  background: var(--fati-accent);
  transition: width .5s var(--ease);
  border-radius: 0 100px 100px 0;
}
.team-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ============================================
   MESSAGE IMAGES
============================================ */
.note-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}
.note-image {
  max-width: 200px;
  max-height: 200px;
  border-radius: 10px;
  cursor: pointer;
  object-fit: cover;
  transition: transform .2s ease;
}
.note-image:hover { transform: scale(1.03); }

/* Notes image preview bar */
.notes-image-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 24px;
}
.notes-image-preview:empty { display: none; }
.notes-image-preview:not(:empty) { padding-top: 10px; padding-bottom: 4px; }
.notes-preview-item {
  position: relative;
  display: inline-block;
}
.notes-preview-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.notes-preview-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-secondary);
  color: #fff;
  border: none;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   PULL-TO-REFRESH
============================================ */
.ptr-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 10px 20px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
  pointer-events: none;
}
.ptr-indicator.ready {
  color: var(--text-primary);
}
.ptr-indicator.ready .ptr-spinner {
  border-top-color: var(--mouad-accent);
}
.ptr-indicator.refreshing .ptr-spinner {
  animation: ptrSpin .6s linear infinite;
}
.ptr-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top: 2px solid var(--text-tertiary);
  border-radius: 50%;
  transition: border-color .2s ease;
}
@keyframes ptrSpin {
  to { transform: rotate(360deg); }
}

/* ============================================
   POPUP IDEA STYLES
============================================ */
.popup-idea-text {
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 20px;
  white-space: pre-wrap;
  color: var(--text-primary);
}
.popup-idea-section {
  margin-bottom: 16px;
}
.popup-idea-section .idea-detail-accounts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.popup-idea-section .idea-detail-account {
  padding: 6px 10px;
  font-size: 12px;
}
.popup-idea-section .idea-detail-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
}
.popup-idea-section .idea-detail-link {
  padding: 8px 12px;
  font-size: 12px;
}

/* Allow scrolling inside popup for long ideas */
.popup-card {
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Prevent overscroll bounce on mobile */
html, body {
  overscroll-behavior-y: none;
}

/* Disable text selection on interactive elements for mobile */
@media (max-width: 768px) {
  .nav-btn, .day-pill, .filter-pill, .post-card, .idea-card, .account-card, .section-card {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
}

/* ============================================
   IMAGE LIGHTBOX
============================================ */
.popup-overlay.lightbox-mode {
  background: rgba(0,0,0,.85);
}
.popup-overlay.lightbox-mode .popup-card {
  background: transparent;
  box-shadow: none;
  max-width: 92vw;
  max-height: 92vh;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.popup-overlay.lightbox-mode .popup-close {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  background: rgba(255,255,255,.15);
  color: #fff;
  width: 40px;
  height: 40px;
  font-size: 24px;
  z-index: 10;
}
.popup-overlay.lightbox-mode .popup-close:hover {
  background: rgba(255,255,255,.25);
}
.lightbox-image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.lightbox-image {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
}

/* ============================================
   STYLE POPUP
============================================ */
.popup-style-section {
  margin-bottom: 16px;
}
.popup-style-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  background: var(--bg);
  color: var(--text-primary);
  transition: border-color .2s ease;
  margin-top: 8px;
}
.popup-style-textarea:focus { outline: none; border-color: var(--text-tertiary); }
.popup-style-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
  margin-top: 8px;
}
