/* ═══════════════════════════════════════════════════
   الضباط المتقاعدين — Design System
   Refactoring UI principles:
   · Hierarchy via weight + color, not size alone
   · Soft shadow + whitespace for cards, no hard borders
   · Accent (indigo) is meaningful — don't sprinkle it
   · Secondary text uses T.slate, not smaller black
   ═══════════════════════════════════════════════════ */

:root {
  --skel-shine:   #eaecef; /* overridden in dark mode */

  /* Identity */
  --indigo:       #4F46E5;
  --indigo-dark:  #3730A3;
  --indigo-light: #6366F1;
  --indigo-pale:  #EEF2FF;
  --indigo-xpale: #F5F3FF;

  /* Accent */
  --amber:        #D97706;
  --amber-light:  #FEF3C7;
  --amber-bright: #F59E0B;

  /* Status */
  --good:         #059669;
  --good-light:   #ECFDF5;
  --warn:         #D97706;
  --warn-light:   #FFFBEB;
  --bad:          #DC2626;
  --bad-light:    #FEF2F2;

  /* Text hierarchy */
  --ink:          #111827;   /* primary text */
  --slate:        #6B7280;   /* secondary */
  --faint:        #9CA3AF;   /* tertiary / placeholder */

  /* Surfaces */
  --bg:           #F9FAFB;
  --surface:      #FFFFFF;
  --panel-bg:     #FFFFFF;

  /* Borders — faint, almost invisible */
  --line:         #E5E7EB;
  --line-soft:    #F3F4F6;

  /* Shadows — the separation tool, not borders */
  --shadow-sm:    0 1px 2px rgba(0,0,0,.06);
  --shadow:       0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:    0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.05);
  --shadow-xl:    0 20px 25px rgba(0,0,0,.1),  0 8px 10px rgba(0,0,0,.04);

  /* Radii */
  --radius:    16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  /* Layout */
  --nav-h:    64px;
  --header-h: 56px;
}

/* ── Reset ───────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, 'Segoe UI', Tahoma, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  direction: rtl;
  text-align: right;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* ── Loading screen ──────────────────────────────── */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(145deg, var(--indigo-dark) 0%, var(--indigo) 60%, var(--indigo-light) 100%);
  color: #fff;
  gap: 16px;
}
.loading-logo { font-size: 64px; line-height: 1; }
.loading-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .3px;
  opacity: .95;
}
.loading-spinner {
  width: 32px; height: 32px;
  border: 2.5px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .75s linear infinite;
  margin-top: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── App Shell ───────────────────────────────────── */
#app { display: flex; flex-direction: column; min-height: 100vh; }
.page { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }

/* ── Header ──────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
}
.header-title {
  flex: 1;
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.2px;
}
.header-logo {
  width: 28px; height: 28px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  flex-shrink: 0;
}
.header-btn {
  background: none; border: none;
  color: var(--slate); font-size: 20px;
  cursor: pointer; padding: 0;
  width: 36px; height: 36px;
  border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.header-btn:hover  { background: var(--line-soft); color: var(--ink); }
.header-btn:active { background: var(--line); }

/* ── Main content ────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 24px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  scrollbar-width: none;
}
.main::-webkit-scrollbar { display: none; }

/* ── Bottom Nav ──────────────────────────────────── */
.bottom-nav {
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--line-soft);
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
  display: flex;
  align-items: flex-start;
  padding-bottom: max(env(safe-area-inset-bottom), 8px);
  padding-bottom: max(env(safe-area-inset-bottom, 8px), 8px);
}
.nav-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  border: none; background: none;
  color: var(--faint);
  font-size: 10px; font-weight: 700;
  letter-spacing: .2px;
  cursor: pointer;
  padding: 6px 0;
  transition: color .15s;
  font-family: inherit;
  position: relative;
}
.nav-item .nav-icon { font-size: 21px; line-height: 1; }
.nav-item.active { color: var(--indigo); }
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 25%; right: 25%;
  height: 2.5px;
  background: var(--indigo);
  border-radius: 0 0 3px 3px;
}
.nav-item:active { opacity: .7; }

/* ── Cards — shadow separation, no hard borders ─── */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 12px;
}
.card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 14px;
}
.card-big-text {
  font-size: 28px; font-weight: 800;
  color: var(--ink); letter-spacing: -.5px;
}
.card-sub { font-size: 13px; color: var(--slate); margin-top: 4px; }

/* ── Status Badges ───────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px; font-weight: 700;
  white-space: nowrap;
}
.badge-red    { background: var(--bad-light);  color: var(--bad);  }
.badge-orange { background: var(--warn-light); color: var(--warn); }
.badge-green  { background: var(--good-light); color: var(--good); }
.badge-indigo { background: var(--indigo-pale); color: var(--indigo); }
.badge-amber  { background: var(--amber-light); color: var(--amber); }
.badge-gray   { background: var(--line-soft);  color: var(--slate); }

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700;
  cursor: pointer; border: none; outline: none;
  font-family: inherit;
  transition: opacity .15s, transform .1s, box-shadow .15s;
  width: 100%;
  letter-spacing: -.1px;
}
.btn:active  { opacity: .85; transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* Primary — indigo filled */
.btn-primary {
  background: var(--indigo);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79,70,229,.3), 0 0 0 0 transparent;
}
.btn-primary:hover { box-shadow: 0 4px 12px rgba(79,70,229,.35); }

/* Danger */
.btn-danger { background: var(--bad); color: #fff; }

/* Amber */
.btn-gold { background: var(--amber-bright); color: #78350F; }

/* Ghost / outline */
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--indigo);
  color: var(--indigo);
}
.btn-ghost {
  background: var(--line-soft);
  color: var(--slate);
  border: 1.5px solid var(--line);
}

/* Small variant */
.btn-sm { padding: 6px 12px; font-size: 12px; width: auto; border-radius: var(--radius-xs); }

.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

/* ── Forms ───────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px; font-weight: 700;
  color: var(--slate);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit;
  color: var(--ink); background: var(--surface);
  outline: none;
  direction: rtl; text-align: right;
  transition: border-color .2s, box-shadow .2s;
}
.form-input:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.form-input::placeholder { color: var(--faint); }

/* ── Divider ─────────────────────────────────────── */
.divider { height: 1px; background: var(--line-soft); margin: 14px 0; }

/* ── List Items ──────────────────────────────────── */
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}
.list-item:last-child  { border-bottom: none; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }
.list-item-icon { font-size: 22px; width: 34px; text-align: center; flex-shrink: 0; }
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.list-item-sub   { font-size: 12px; color: var(--slate); margin-top: 2px; }
.list-item-end   { flex-shrink: 0; }

/* ── Section headers ─────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-title { font-size: 16px; font-weight: 800; color: var(--ink); letter-spacing: -.2px; }
.section-link  { font-size: 13px; color: var(--indigo); font-weight: 600; cursor: pointer; }

/* ── Stats row ───────────────────────────────────── */
.stats-row {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 10px;
  margin-bottom: 12px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 14px 8px; text-align: center;
  box-shadow: var(--shadow);
}
.stat-num { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.stat-lbl { font-size: 11px; color: var(--slate); margin-top: 3px; font-weight: 600; }

/* ── Vote buttons ────────────────────────────────── */
.vote-btn-row { display: flex; gap: 10px; margin-top: 14px; }
.vote-btn {
  flex: 1; padding: 13px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 15px; font-weight: 800;
  cursor: pointer; transition: all .15s;
  font-family: inherit; color: var(--slate);
}
.vote-btn.maak  { border-color: var(--good);  background: var(--good-light);  color: var(--good); }
.vote-btn.mabii { border-color: var(--bad);   background: var(--bad-light);   color: var(--bad);  }
.vote-btn:active { transform: scale(.97); }

/* ── Progress bar ────────────────────────────────── */
.progress-bar {
  height: 6px; background: var(--line-soft);
  border-radius: 99px; overflow: hidden; margin: 10px 0;
}
.progress-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--indigo), var(--indigo-light));
  transition: width .5s ease;
}

/* ── Empty state ─────────────────────────────────── */
.empty {
  text-align: center; padding: 48px 20px;
  color: var(--faint);
}
.empty-icon { font-size: 44px; margin-bottom: 12px; opacity: .7; }
.empty-text { font-size: 14px; color: var(--slate); }

/* ── Modal ───────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(17,24,39,.5);
  backdrop-filter: blur(2px);
  z-index: 500;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .2s;
}
.modal {
  background: var(--surface);
  width: 100%; max-width: 480px;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  box-shadow: var(--shadow-xl);
  animation: slideUp .25s cubic-bezier(.22,.68,0,1.2);
  max-height: 90vh; overflow-y: auto;
}
.modal-handle {
  width: 36px; height: 4px;
  background: var(--line);
  border-radius: 99px;
  margin: 0 auto 18px;
}
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 16px; letter-spacing: -.3px; }
@keyframes fadeIn  { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(60px); opacity: 0; } }

/* ── Toast ───────────────────────────────────────── */
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  color: #fff;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s cubic-bezier(.22,.68,0,1.2);
  pointer-events: auto;
  backdrop-filter: blur(8px);
  width: 100%;
}
.toast-success { background: var(--good); }
.toast-error   { background: var(--bad);  }
.toast-info    { background: var(--indigo); }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } }

/* ── Login page ──────────────────────────────────── */
.login-page { height: 100vh; overflow-y: auto; display: flex; flex-direction: column; background: var(--bg); }
.login-hero {
  background: linear-gradient(145deg, var(--indigo-dark) 0%, var(--indigo) 65%, var(--indigo-light) 100%);
  color: #fff;
  padding: 56px 24px 44px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
/* subtle background pattern */
.login-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 70% 20%, rgba(255,255,255,.08) 0%, transparent 60%),
              radial-gradient(circle at 20% 80%, rgba(255,255,255,.05) 0%, transparent 50%);
  pointer-events: none;
}
.login-hero-logo  { position: relative; margin-bottom: 14px; }
.login-hero-title { font-size: 26px; font-weight: 800; letter-spacing: -.3px; position: relative; }
.login-hero-sub   { font-size: 14px; opacity: .75; margin-top: 6px; position: relative; }
.login-form-area  { flex: 1; padding: 28px 20px; max-width: 480px; width: 100%; margin: 0 auto; }
.login-form-area .btn { margin-top: 6px; padding: 14px; font-size: 16px; }

/* ── Greeting card ───────────────────────────────── */
.greeting {
  background: linear-gradient(135deg, var(--indigo-dark), var(--indigo));
  color: #fff;
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 12px;
  position: relative; overflow: hidden;
}
.greeting::after {
  content: '';
  position: absolute; top: -20px; left: -20px;
  width: 100px; height: 100px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
}
.greeting-name { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.greeting-sub  { font-size: 13px; opacity: .75; margin-top: 3px; }

/* ── Install banner ──────────────────────────────── */
.install-banner {
  background: var(--indigo-pale);
  border: 1.5px solid rgba(79,70,229,.15);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 12px;
}
.install-banner-icon  { font-size: 26px; flex-shrink: 0; }
.install-banner-body  { flex: 1; }
.install-banner-title { font-size: 14px; font-weight: 700; color: var(--indigo-dark); }
.install-banner-sub   { font-size: 12px; color: var(--indigo); opacity: .8; margin-top: 2px; }
.install-banner-btn {
  background: var(--indigo);
  border: none; color: #fff;
  padding: 7px 14px;
  border-radius: var(--radius-xs);
  font-size: 12px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  font-family: inherit;
}

/* ── iOS steps ───────────────────────────────────── */
.ios-steps { list-style: none; padding: 0; }
.ios-steps li {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px; color: var(--ink);
}
.ios-steps li:last-child { border-bottom: none; }
.ios-step-num {
  width: 26px; height: 26px;
  background: var(--indigo); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
  flex-shrink: 0;
}

/* ── Notification prompt ─────────────────────────── */
.notif-prompt {
  background: var(--amber-light);
  border: 1.5px solid rgba(217,119,6,.2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px;
}
.notif-prompt-icon  { font-size: 22px; }
.notif-prompt-body  { flex: 1; }
.notif-prompt-title { font-size: 14px; font-weight: 700; color: #78350F; }
.notif-prompt-sub   { font-size: 12px; color: var(--amber); margin-top: 2px; }
.notif-prompt-btn {
  background: var(--amber-bright); border: none;
  padding: 7px 14px; border-radius: var(--radius-xs);
  font-size: 12px; font-weight: 700; color: #78350F;
  cursor: pointer; white-space: nowrap; font-family: inherit;
}

/* ── Tabs ────────────────────────────────────────── */
.tabs {
  display: flex;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 4px; gap: 2px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.tab {
  flex: 1; padding: 8px;
  text-align: center; font-size: 13px; font-weight: 700;
  border-radius: var(--radius-xs);
  cursor: pointer; border: none;
  background: none; color: var(--slate);
  font-family: inherit; transition: all .15s;
}
.tab.active { background: var(--indigo); color: #fff; box-shadow: var(--shadow-sm); }

/* ── Amount row ──────────────────────────────────── */
.amount-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px; margin-bottom: 12px;
}
.amount-row:focus-within {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.amount-row input {
  flex: 1; border: none; outline: none;
  font-size: 17px; font-weight: 700;
  color: var(--ink); background: none;
  text-align: right; font-family: inherit;
}
.amount-currency { font-size: 13px; color: var(--slate); font-weight: 600; }

/* ── Member rows ─────────────────────────────────── */
.member-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.member-row:last-child { border-bottom: none; }
.member-avatar {
  width: 38px; height: 38px;
  background: var(--indigo-pale); color: var(--indigo);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800;
  flex-shrink: 0;
}
.member-name    { font-size: 15px; font-weight: 700; color: var(--ink); }
.member-role    { font-size: 11px; color: var(--slate); margin-top: 1px; }
.member-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Inline spinner ──────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}

/* ══════════════════════════════════════════════════
   Confirm Dialog (confirmDialog())
   ══════════════════════════════════════════════════ */
.cdialog-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(17,24,39,.45);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .18s ease;
}
.cdialog-overlay.cdialog-visible { opacity: 1; }
.cdialog-overlay.cdialog-hiding  { opacity: 0; }

.cdialog {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  padding: 24px 20px 20px;
  width: 100%; max-width: 320px;
  transform: translateY(24px) scale(.97);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.cdialog-overlay.cdialog-visible .cdialog {
  transform: translateY(0) scale(1);
}

.cdialog-msg {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  line-height: 1.5;
  margin: 0 0 20px;
}

.cdialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.cdialog-actions .btn { flex: 1; justify-content: center; }

/* ══════════════════════════════════════════════════
   Toast container (notify())
   Sits above the nav bar so it's never hidden
   ══════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: calc(var(--nav-h) + max(env(safe-area-inset-bottom), 0px) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: 100%;
  max-width: 380px;
  padding: 0 16px;
  box-sizing: border-box;
}
#toast-container .toast {
  pointer-events: auto;
  width: 100%;
}

/* ══════════════════════════════════════════════════
   Compatibility aliases (old pages use these names)
   ══════════════════════════════════════════════════ */
:root {
  --green:      var(--good);
  --orange:     var(--warn);
  --red:        var(--bad);
  --gold:       var(--amber);
  --text2:      var(--slate);
  --text3:      var(--faint);
  --green-pale: var(--good-light);
}

/* ══════════════════════════════════════════════════
   Login Page — gradient hero + bubble design
   ══════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, #1e1b4b 0%, #4338ca 40%, #6d28d9 70%, #7c3aed 100%);
  z-index: 0;
}

.lbubble {
  position: absolute; border-radius: 50%;
  animation: lbfloat 10s ease-in-out infinite;
  opacity: .12;
}
.lb1 { width: 280px; height: 280px; top: -80px; right: -60px;  background: #a5b4fc; animation-delay: 0s; }
.lb2 { width: 180px; height: 180px; top: 35%;  left: -50px;   background: #c4b5fd; animation-delay: 3s; }
.lb3 { width: 140px; height: 140px; bottom: 35%; right: 15%;  background: #818cf8; animation-delay: 6s; }

@keyframes lbfloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-22px) scale(1.06); }
}

.login-hero {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px 32px;
  position: relative; z-index: 1;
  text-align: center;
  gap: 12px;
}

.login-logo-wrap {
  animation: logobounce 1s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes logobounce {
  0%   { transform: scale(.4) translateY(30px); opacity: 0; }
  100% { transform: scale(1)  translateY(0);    opacity: 1; }
}

.login-title {
  font-size: 26px; font-weight: 900;
  color: #fff; letter-spacing: -.3px;
  text-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.login-tagline {
  font-size: 15px; color: rgba(255,255,255,.75);
  font-weight: 500;
}

.login-card {
  position: relative; z-index: 1;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  padding: 28px 24px 40px;
  box-shadow: 0 -8px 40px rgba(0,0,0,.2);
  width: 100%;
}

/* Wider screens — centered floating card */
@media (min-width: 520px) {
  .login-page {
    align-items: center;
    justify-content: center;
  }
  .login-hero {
    flex: unset;
    padding: 40px 24px 16px;
    width: 100%;
    max-width: 460px;
  }
  .login-card {
    max-width: 460px;
    border-radius: 28px;
    margin-bottom: 48px;
    box-shadow: 0 24px 64px rgba(0,0,0,.35);
  }
}

.login-error-msg {
  color: var(--bad); text-align: center;
  margin-top: 12px; font-size: 14px;
}

/* ── Locked identity card ── */
.lock-identity {
  display: flex; align-items: center; gap: 16px;
  background: var(--indigo-pale);
  border-radius: 14px; padding: 16px 18px;
  margin-bottom: 20px;
}
.lock-avatar {
  width: 52px; height: 52px;
  background: var(--indigo); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; flex-shrink: 0;
}
.lock-name { font-size: 18px; font-weight: 800; color: var(--ink); }
.lock-code { font-size: 13px; color: var(--slate); margin-top: 2px; }

.btn-block { width: 100%; justify-content: center; }

/* ══════════════════════════════════════════════════
   FAB — Floating Action Button
   Sits ABOVE the nav bar + safe area, never behind it
   ══════════════════════════════════════════════════ */
.fab {
  position: fixed;
  /* clear nav-h (64px) + safe-area + 14px breathing room */
  bottom: calc(var(--nav-h) + max(env(safe-area-inset-bottom), 0px) + 14px);
  left: 18px;
  width: 56px; height: 56px;
  background: var(--indigo);
  border-radius: 50%;
  font-size: 28px; line-height: 1; color: #fff;
  border: none; cursor: pointer;
  box-shadow: 0 6px 20px rgba(79,70,229,.5);
  z-index: 90;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, box-shadow .15s;
}
.fab:hover  { box-shadow: 0 8px 28px rgba(79,70,229,.6); transform: scale(1.06); }
.fab:active { transform: scale(.92); box-shadow: 0 3px 12px rgba(79,70,229,.4); }

/* Extra bottom padding on pages that have a FAB */
.main-fab { padding-bottom: calc(var(--nav-h) + 40px) !important; }

/* ══════════════════════════════════════════════════
   Skeleton Loaders
   ══════════════════════════════════════════════════ */
.skel {
  background: linear-gradient(90deg, var(--line-soft) 25%, var(--skel-shine) 50%, var(--line-soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  0%   { background-position:  200% 0; }
  100% { background-position: -200% 0; }
}
.skel-line  { height: 14px; border-radius: 7px; margin: 6px 0; }
.skel-line.short { width: 45%; }
.skel-block { border-radius: 10px; }
.skel-card  { padding: 20px; }

/* ══════════════════════════════════════════════════
   Size bumps — slightly larger than original
   ══════════════════════════════════════════════════ */
.card         { padding: 20px; }
.card-title   { font-size: 15px; margin-bottom: 14px; }
.form-input   { padding: 14px 16px; font-size: 16px; }
.btn          { padding: 12px 22px; font-size: 15px; }
.btn-sm       { padding: 8px 14px;  font-size: 14px; }
.stat-num     { font-size: 28px; }
.stat-lbl     { font-size: 12px; }
.member-name  { font-size: 16px; }
.list-item-title { font-size: 15px; }
.nav-icon     { font-size: 20px; }
.nav-item     { font-size: 10px; }

/* nav-label span inside each nav-item */
.nav-label { display: block; }

/* 7-item nav: tighten slightly on narrow screens */
@media (max-width: 420px) {
  .nav-item { font-size: 9px; padding: 5px 0; }
  .nav-item .nav-icon { font-size: 18px; }
}

/* ── Live match dot ──────────────────────────────── */
.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #dc2626;
  flex-shrink: 0;
  animation: live-pulse 1.2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1;   transform: scale(1);    }
  50%       { opacity: .4; transform: scale(1.35); }
}

/* deadline countdown pill */
.deadline-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px;
  margin-top: 6px;
}
.deadline-pill.urgent { background: var(--bad-light);  color: var(--bad); }
.deadline-pill.soon   { background: var(--warn-light); color: var(--warn); }
.deadline-pill.ok     { background: var(--good-light); color: var(--good); }
.deadline-pill.ended  { background: var(--line-soft);  color: var(--faint); }

/* ══════════════════════════════════════════════════
   Dark Mode — CSS Variables
   Applied via:  @media prefers-color-scheme:dark  (auto)
                 [data-theme="dark"]               (manual)
   Light override: [data-theme="light"]
   ══════════════════════════════════════════════════ */

/* Shared dark variable block — repeated intentionally for both auto + manual */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --skel-shine:    #2a3a4e;
    --indigo:        #6366f1;
    --indigo-dark:   #4f46e5;
    --indigo-light:  #818cf8;
    --indigo-pale:   #1e1b4b;
    --indigo-xpale:  #161437;
    --amber:         #fbbf24;
    --amber-light:   #1c1506;
    --amber-bright:  #f59e0b;
    --good:          #34d399;
    --good-light:    #052e16;
    --warn:          #fbbf24;
    --warn-light:    #1c1506;
    --bad:           #f87171;
    --bad-light:     #2d0a0a;
    --ink:           #f1f5f9;
    --slate:         #94a3b8;
    --faint:         #64748b;
    --bg:            #0f172a;
    --surface:       #1e293b;
    --panel-bg:      #1e293b;
    --line:          #334155;
    --line-soft:     #243347;
    --shadow-sm:     0 1px 3px rgba(0,0,0,.5);
    --shadow:        0 2px 6px rgba(0,0,0,.55), 0 1px 2px rgba(0,0,0,.4);
    --shadow-md:     0 4px 10px rgba(0,0,0,.55);
    --shadow-lg:     0 10px 24px rgba(0,0,0,.65);
    --shadow-xl:     0 20px 48px rgba(0,0,0,.75);
  }
}
[data-theme="dark"] {
  --skel-shine:    #2a3a4e;
  --indigo:        #6366f1;
  --indigo-dark:   #4f46e5;
  --indigo-light:  #818cf8;
  --indigo-pale:   #1e1b4b;
  --indigo-xpale:  #161437;
  --amber:         #fbbf24;
  --amber-light:   #1c1506;
  --amber-bright:  #f59e0b;
  --good:          #34d399;
  --good-light:    #052e16;
  --warn:          #fbbf24;
  --warn-light:    #1c1506;
  --bad:           #f87171;
  --bad-light:     #2d0a0a;
  --ink:           #f1f5f9;
  --slate:         #94a3b8;
  --faint:         #64748b;
  --bg:            #0f172a;
  --surface:       #1e293b;
  --panel-bg:      #1e293b;
  --line:          #334155;
  --line-soft:     #243347;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.5);
  --shadow:        0 2px 6px rgba(0,0,0,.55), 0 1px 2px rgba(0,0,0,.4);
  --shadow-md:     0 4px 10px rgba(0,0,0,.55);
  --shadow-lg:     0 10px 24px rgba(0,0,0,.65);
  --shadow-xl:     0 20px 48px rgba(0,0,0,.75);
}

/* Force light mode override */
[data-theme="light"] {
  color-scheme: light;
}

/* ── Dark-mode specific tweaks ────────────────────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .badge-indigo { color: var(--indigo-light); }
  :root:not([data-theme="light"]) .bottom-nav   { box-shadow: 0 -2px 16px rgba(0,0,0,.4); }
  :root:not([data-theme="light"]) .cdialog      { box-shadow: 0 20px 60px rgba(0,0,0,.7); }
  :root:not([data-theme="light"]) .stat-card    { background: #263244; }
  :root:not([data-theme="light"]) .form-input   { background: #152032; border-color: var(--line); }
  :root:not([data-theme="light"]) .btn-ghost    { background: #263244; border-color: #334155; color: var(--slate); }
  :root:not([data-theme="light"]) .vote-btn     { background: #263244; border-color: var(--line); color: var(--slate); }
}
[data-theme="dark"] .badge-indigo { color: var(--indigo-light); }
[data-theme="dark"] .bottom-nav   { box-shadow: 0 -2px 16px rgba(0,0,0,.4); }
[data-theme="dark"] .cdialog      { box-shadow: 0 20px 60px rgba(0,0,0,.7); }
[data-theme="dark"] .stat-card    { background: #263244; }
[data-theme="dark"] .form-input   { background: #152032; border-color: var(--line); }
[data-theme="dark"] .btn-ghost    { background: #263244; border-color: #334155; color: var(--slate); }
[data-theme="dark"] .vote-btn     { background: #263244; border-color: var(--line); color: var(--slate); }
