/* ═══════════════════════════════════════════════════════════════
   BIZCONNECT v2.0 — Design System
   Rose/Gold theme, mobile-first, elegant
   ═══════════════════════════════════════════════════════════════ */

:root {
  --rose: #e8637a;
  --rose-light: #fde8ec;
  --rose-dark: #c0435a;
  --rose-50: rgba(232, 99, 122, 0.06);
  --gold: #d4a843;
  --gold-light: #fdf3dc;
  --gold-dark: #b8912e;
  --cream: #fdfaf6;
  --ink: #1e1a18;
  --ink-light: #3a3330;
  --muted: #7a6f6a;
  --muted-light: #a89e98;
  --card: #ffffff;
  --border: #ede8e3;
  --border-light: #f5f0ea;
  --success: #3cb97e;
  --success-bg: #eaf7f1;
  --danger: #e54d4d;
  --danger-bg: #fdeaea;
  --warning: #e8a534;
  --warning-bg: #fef6e6;
  --info: #4d8ce5;
  --info-bg: #eaf0fd;
  --nav-height: 64px;
  --header-bg: linear-gradient(135deg, #2b1a1d 0%, #4a2630 60%, #3b1e2a 100%);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 50px;
}

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

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(232,99,122,0.05) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(212,168,67,0.05) 0%, transparent 50%);
}


/* ─── APP LAYOUT ─────────────────────────────────────────────── */

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--nav-height);
  height: 100vh;
  overflow: hidden;
}

.view { display: none; flex-direction: column; min-height: 0; flex: 1; overflow: hidden; }
.view.active { display: flex; }

.view-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 24px;
}


/* ─── PAGE HEADER ────────────────────────────────────────────── */

.page-header {
  background: var(--header-bg);
  padding: 24px 20px 20px;
  position: relative;
  overflow: hidden;
}
.page-header::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: rgba(232,99,122,0.1);
}
.page-header::after {
  content: '';
  position: absolute;
  bottom: -50px; left: -20px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(212,168,67,0.06);
}
.page-header * { position: relative; z-index: 1; }

.page-header .badge {
  display: inline-block;
  background: rgba(212,168,67,0.18);
  border: 1px solid rgba(212,168,67,0.35);
  color: var(--gold);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 10px;
}
.page-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(22px, 5vw, 32px);
  color: #fff;
  line-height: 1.2;
  margin-bottom: 6px;
}
.page-header h1 .accent { color: var(--rose); }
.page-header p {
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  max-width: 320px;
  line-height: 1.5;
}


/* ─── SECTION HEADER ─────────────────────────────────────────── */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 12px;
}
.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  color: var(--ink);
}
.section-link {
  font-size: 12px;
  color: var(--rose);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}


/* ─── CARDS ──────────────────────────────────────────────────── */

.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 12px;
}
.card-flat {
  background: var(--card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 8px;
}


/* ─── STAT CARDS ─────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 16px 14px;
  text-align: center;
}
.stat-card .stat-icon {
  font-size: 20px;
  margin-bottom: 6px;
}
.stat-card .stat-value {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--rose-dark);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card .stat-label {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 500;
}
.stat-card.highlight {
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-dark) 100%);
  border-color: var(--rose);
}
.stat-card.highlight .stat-value { color: #fff; }
.stat-card.highlight .stat-label { color: rgba(255,255,255,0.7); }
.stat-card.highlight .stat-icon { filter: brightness(0) invert(1); }


/* ─── FORMS ──────────────────────────────────────────────────── */

.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 7px;
  letter-spacing: 0.2px;
}
.form-label .req { color: var(--rose); margin-left: 2px; }
.form-label .hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 11.5px;
  margin-left: 4px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: #fdfaf8;
  transition: all 0.2s;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--rose);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(232,99,122,0.1);
}
.form-input::placeholder,
.form-textarea::placeholder { color: #bfb8b3; }
.form-input:disabled,
.form-select:disabled {
  opacity: 0.6;
  background: var(--border-light);
  cursor: not-allowed;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a6f6a' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

.amount-wrap { position: relative; }
.amount-wrap .rupee {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--muted);
  font-weight: 600;
  pointer-events: none;
}
.amount-wrap .form-input { padding-left: 32px; }

.form-group.error .form-input,
.form-group.error .form-select { border-color: var(--danger); }
.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 5px;
  display: none;
}
.form-group.error .form-error { display: block; }

.form-readonly {
  padding: 13px 16px;
  background: var(--border-light);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Toggle pills */
.toggle-pills {
  display: flex;
  background: var(--border-light);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}
.toggle-pill {
  flex: 1;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.toggle-pill.active {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* Searchable dropdown */
.search-dropdown { position: relative; }
.search-dropdown .form-input { padding-right: 36px; }
.search-dropdown-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.search-dropdown.open .search-dropdown-list { display: block; }
.search-dropdown-item {
  padding: 11px 16px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}
.search-dropdown-item:hover,
.search-dropdown-item.highlighted { background: var(--rose-50); }
.search-dropdown-item:last-child { border-bottom: none; }
.search-dropdown-empty {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
.search-dropdown.external-mode .search-dropdown-list { display: none !important; }


/* ─── BUTTONS ────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-dark) 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(232,99,122,0.3);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(232,99,122,0.4);
}

.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--rose);
  color: var(--rose);
}
.btn-secondary:hover { background: var(--rose-light); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--muted);
}
.btn-outline:hover { border-color: var(--muted-light); background: var(--border-light); }

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  font-size: 16px;
}

.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }

/* Spinner inside button */
.btn .spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}
.btn.loading .spinner { display: block; }
.btn.loading .btn-text { display: none; }

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

/* FAB */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + 20px);
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-dark) 100%);
  color: #fff;
  font-size: 28px;
  border: none;
  box-shadow: 0 4px 20px rgba(232,99,122,0.4);
  cursor: pointer;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.fab:hover { transform: scale(1.05); box-shadow: 0 6px 24px rgba(232,99,122,0.5); }
.fab:active { transform: scale(0.95); }


/* ─── BOTTOM NAV ─────────────────────────────────────────────── */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
  border: none;
  background: none;
  font-family: 'DM Sans', sans-serif;
  padding: 4px 0;
}
.nav-item .nav-icon {
  font-size: 22px;
  line-height: 1;
  opacity: 0.5;
  transition: all 0.2s;
}
.nav-item .nav-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.3px;
  transition: color 0.2s;
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-item.active .nav-label { color: var(--rose); font-weight: 600; }
.nav-item.nav-submit {
  position: relative;
  margin-top: -14px;
}
.nav-item.nav-submit .nav-icon {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-dark) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  opacity: 1;
  box-shadow: 0 3px 12px rgba(232,99,122,0.35);
}


/* ─── ENTRY LIST ITEMS ───────────────────────────────────────── */

.entry-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}
.entry-item:last-child { border-bottom: none; }

.entry-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--rose-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.entry-avatar.external { background: var(--gold-light); }

.entry-body { flex: 1; min-width: 0; }
.entry-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.entry-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.entry-amount {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--rose-dark);
  flex-shrink: 0;
  text-align: right;
}

/* Type badge */
.badge-type {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.badge-member { background: var(--rose-light); color: var(--rose-dark); }
.badge-external { background: var(--gold-light); color: var(--gold-dark); }


/* ─── LEADERBOARD ────────────────────────────────────────────── */

.leader-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  transition: background 0.15s;
}
.leader-item.me {
  background: var(--rose-50);
  border-color: rgba(232,99,122,0.2);
}
.leader-item.top-1 { border-left: 3px solid #ffd700; }
.leader-item.top-2 { border-left: 3px solid #c0c0c0; }
.leader-item.top-3 { border-left: 3px solid #cd7f32; }

.leader-rank {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}
.leader-item.top-1 .leader-rank { background: #ffd700; color: #5c4a00; }
.leader-item.top-2 .leader-rank { background: #e0e0e0; color: #555; }
.leader-item.top-3 .leader-rank { background: #f0d0a0; color: #6d4c00; }

.leader-info { flex: 1; min-width: 0; }
.leader-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.leader-count {
  font-size: 11px;
  color: var(--muted);
}
.leader-total {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--rose-dark);
}


/* ─── MEMBER LIST (ADMIN) ────────────────────────────────────── */

.member-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  background: var(--card);
}
.member-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--rose-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--rose-dark);
  flex-shrink: 0;
}
.member-info { flex: 1; min-width: 0; }
.member-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.member-detail { font-size: 11px; color: var(--muted); }
.member-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.member-item.inactive { opacity: 0.55; }
.badge-role {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 6px;
}
.badge-admin { background: var(--gold-light); color: var(--gold-dark); }


/* ─── ADMIN TABS ─────────────────────────────────────────────── */

.admin-tabs {
  display: flex;
  gap: 2px;
  background: var(--border-light);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin: 16px 0 12px;
}
.admin-tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  background: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  text-align: center;
  transition: all 0.2s;
}
.admin-tab.active {
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.admin-panel { display: none; }
.admin-panel.active { display: block; }


/* ─── MONTH SELECTOR ─────────────────────────────────────────── */

.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 0;
}
.month-nav button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  color: var(--muted);
}
.month-nav button:hover { border-color: var(--rose); color: var(--rose); }
.month-label {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 600;
  min-width: 140px;
  text-align: center;
}


/* ─── TOTAL BANNER ───────────────────────────────────────────── */

.total-banner {
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-dark) 100%);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.total-banner .total-label {
  font-size: 12px;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.total-banner .total-value {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
}
.total-banner .total-count {
  font-size: 12px;
  opacity: 0.7;
}


/* ─── SUCCESS / EMPTY STATES ─────────────────────────────────── */

.success-state {
  text-align: center;
  padding: 32px 20px;
}
.success-icon-wrap {
  width: 72px; height: 72px;
  background: var(--success-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 32px;
  animation: pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes pop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.success-state h2 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  margin-bottom: 8px;
}
.success-state p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.success-summary {
  background: var(--gold-light);
  border: 1px solid rgba(212,168,67,0.3);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  text-align: left;
  margin-bottom: 20px;
}
.success-summary .summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(212,168,67,0.15);
}
.success-summary .summary-row:last-child { border-bottom: none; }
.summary-row .key { color: var(--muted); }
.summary-row .val { font-weight: 600; color: var(--ink); }

.empty-state {
  text-align: center;
  padding: 48px 24px;
}
.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}
.empty-state h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}


/* ─── LOADING ────────────────────────────────────────────────── */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: opacity 0.3s;
}
.loading-overlay.fade-out { opacity: 0; pointer-events: none; }

.loading-dots {
  display: flex;
  gap: 8px;
}
.loading-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rose);
  animation: bounce 1.4s infinite ease-in-out;
}
.loading-dots span:nth-child(2) { animation-delay: 0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.5); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, #f0ebe5 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.skeleton-line { height: 16px; margin-bottom: 10px; }
.skeleton-line.short { width: 60%; }
.skeleton-card { height: 80px; margin-bottom: 10px; border-radius: var(--radius-md); }


/* ─── VIEW LOADING OVERLAY ───────────────────────────────────── */

.view-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  gap: 12px;
}
.view-loading .loading-dots { display: flex; gap: 6px; }
.view-loading .loading-dots span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--rose);
  animation: bounce 1.4s infinite ease-in-out;
}
.view-loading .loading-dots span:nth-child(2) { animation-delay: 0.16s; }
.view-loading .loading-dots span:nth-child(3) { animation-delay: 0.32s; }
.view-loading-text {
  font-size: 13px; color: var(--muted); margin-top: 4px;
}

/* Inline spinner for sections */
.inline-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 24px; gap: 10px; color: var(--muted); font-size: 13px;
}
.inline-loading::before {
  content: ''; width: 18px; height: 18px;
  border: 2px solid var(--border); border-top-color: var(--rose);
  border-radius: 50%; animation: spin 0.6s linear infinite;
}

/* Disabled overlay for forms during submission */
.form-submitting { position: relative; pointer-events: none; opacity: 0.6; }
.form-submitting::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(253,250,246,0.5); z-index: 10;
}


/* ─── TOAST ──────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: slideDown 0.3s ease-out;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); color: var(--ink); }

@keyframes slideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}


/* ─── MODAL ──────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px 20px 32px;
  animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
}
.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--border-light);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

/* Desktop modal */
@media (min-width: 500px) {
  .modal {
    border-radius: var(--radius-lg);
    margin-bottom: auto;
    align-self: center;
  }
}


/* ─── LOGIN PAGE ─────────────────────────────────────────────── */

.view.login-page {
  min-height: 100vh;
  flex-direction: column;
}
.view.login-page.active {
  display: flex;
}
.login-header {
  background: var(--header-bg);
  padding: 60px 24px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.login-header::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: rgba(232,99,122,0.1);
}
.login-header .logo {
  font-size: 48px;
  margin-bottom: 16px;
}
.login-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  color: #fff;
  margin-bottom: 8px;
  position: relative;
}
.login-header p {
  color: rgba(255,255,255,0.55);
  font-size: 14px;
  position: relative;
}

.login-form {
  flex: 1;
  padding: 28px 20px;
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
}
.login-form .form-group { margin-bottom: 24px; }

.pin-input-group {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.pin-digit {
  width: 52px;
  height: 58px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fdfaf8;
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  outline: none;
  transition: all 0.2s;
}
.pin-digit:focus {
  border-color: var(--rose);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(232,99,122,0.1);
}

.login-hint {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 24px;
  line-height: 1.6;
}

.login-footer {
  text-align: center;
  padding: 20px;
  font-size: 11px;
  color: #ccc;
}


/* ─── PROFILE SECTION ────────────────────────────────────────── */

.profile-card {
  text-align: center;
  padding: 24px 20px;
}
.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--rose-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: var(--rose-dark);
  margin: 0 auto 12px;
}
.profile-name {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  margin-bottom: 4px;
}
.profile-role {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.profile-menu { margin-top: 20px; }
.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  background: var(--card);
  transition: background 0.15s;
  width: 100%;
  text-align: left;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
}
.profile-menu-item:hover { background: var(--border-light); }
.profile-menu-item .menu-icon { font-size: 20px; }
.profile-menu-item .menu-arrow {
  margin-left: auto;
  color: var(--muted-light);
  font-size: 16px;
}
.profile-menu-item.danger { color: var(--danger); }


/* ─── RESPONSIVE ─────────────────────────────────────────────── */

@media (max-width: 380px) {
  .stats-grid { gap: 6px; }
  .stat-card { padding: 12px 10px; }
  .stat-card .stat-value { font-size: 18px; }
  .page-header { padding: 20px 16px 16px; }
  .view-scroll { padding: 0 12px 20px; }
  .pin-digit { width: 46px; height: 52px; font-size: 20px; }
}

@media (min-width: 600px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .view-scroll { padding: 0 24px 32px; max-width: 640px; margin: 0 auto; width: 100%; }
  .page-header { text-align: center; }
  .page-header p { margin: 0 auto; }
}

/* Hide scrollbar */
.view-scroll::-webkit-scrollbar { display: none; }
.view-scroll { -ms-overflow-style: none; scrollbar-width: none; }
