:root {
  --bg: #0f172a;
  --bg2: #1e293b;
  --bg3: #334155;
  --card: #1e293b;
  --card2: #263145;
  --border: rgba(255,255,255,0.08);
  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #64748b;
  --accent: #6366f1;
  --accent2: #8b5cf6;
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --blue: #3b82f6;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --font: 'DM Sans', sans-serif;
  --font-display: 'Syne', sans-serif;
  --currency: '₹';
}

.light-mode {
  --bg: #f8fafc;
  --bg2: #ffffff;
  --bg3: #e2e8f0;
  --card: #ffffff;
  --card2: #f1f5f9;
  --border: rgba(0,0,0,0.08);
  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

.screen { position: fixed; inset: 0; overflow: hidden; }
.screen.active { display: flex; flex-direction: column; }
.screen:not(.active) { display: none; }

/* ---- AUTH ---- */
#auth-screen {
  background: var(--bg);
  justify-content: flex-end;
  padding: env(safe-area-inset-top, 20px) 0 0;
}

.auth-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.auth-orb {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.25;
  animation: orbFloat 8s ease-in-out infinite;
}
.orb1 { width: 300px; height: 300px; background: #6366f1; top: -80px; left: -60px; animation-delay: 0s; }
.orb2 { width: 250px; height: 250px; background: #8b5cf6; top: 60px; right: -60px; animation-delay: -3s; }
.orb3 { width: 200px; height: 200px; background: #06b6d4; bottom: 20%; left: 20%; animation-delay: -5s; }

@keyframes orbFloat {
  0%,100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.05); }
}

.auth-view {
  display: none;
  position: relative; z-index: 1;
  background: var(--card);
  border-radius: 28px 28px 0 0;
  padding: 32px 24px env(safe-area-inset-bottom, 24px);
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.35s cubic-bezier(0.4,0,0.2,1);
  flex-shrink: 0;
}
.auth-view.active { display: block; }

#splash-view {
  background: transparent;
  padding: 48px 28px env(safe-area-inset-bottom, 32px);
  max-height: none;
  animation: fadeIn 0.5s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.splash-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 48px; }
.logo-icon { width: 44px; height: 44px; border-radius: 12px; overflow: hidden; }
.logo-text { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--text); }

.splash-title {
  font-family: var(--font-display);
  font-size: 38px; font-weight: 800;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 16px;
}
.splash-sub { color: var(--text2); font-size: 16px; margin-bottom: 24px; }
.splash-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 40px; }
.pill {
  background: var(--bg3); color: var(--text2);
  padding: 6px 14px; border-radius: 100px; font-size: 13px;
}
.splash-actions { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.splash-legal { font-size: 12px; color: var(--text3); text-align: center; }
.splash-legal a { color: var(--accent); text-decoration: none; }

.back-btn {
  background: none; border: none; color: var(--text2);
  padding: 4px; cursor: pointer; margin-bottom: 16px;
  display: flex; align-items: center;
}
.auth-title { font-family: var(--font-display); font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.auth-sub { color: var(--text2); font-size: 15px; margin-bottom: 24px; }
.auth-switch { text-align: center; font-size: 14px; color: var(--text2); margin-top: 16px; }
.auth-switch a { color: var(--accent); text-decoration: none; }

.social-btn {
  width: 100%; padding: 14px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 15px; font-weight: 500; cursor: pointer;
  transition: all 0.2s;
}
.social-btn:hover { background: var(--bg3); }

.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; color: var(--text3); font-size: 13px;
}
.divider::before,.divider::after {
  content: ''; flex: 1;
  height: 1px; background: var(--border);
}

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; font-weight: 500; }
.form-input {
  width: 100%; padding: 13px 14px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 15px; font-family: var(--font);
  outline: none; transition: border-color 0.2s;
  -webkit-appearance: none;
}
.form-input:focus { border-color: var(--accent); }
.form-input option { background: var(--bg2); }
.big-input { font-size: 28px; font-weight: 600; text-align: center; padding: 16px; }

.input-row { position: relative; }
.input-row .form-input { padding-right: 48px; }
.eye-btn {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 16px; opacity: 0.6;
}

.forgot-link { display: block; text-align: right; font-size: 13px; color: var(--accent); text-decoration: none; margin-bottom: 20px; }

.pass-strength { height: 4px; border-radius: 2px; background: var(--bg3); margin-bottom: 16px; margin-top: -10px; transition: all 0.3s; }

.otp-icon { font-size: 48px; text-align: center; margin-bottom: 16px; }
.otp-boxes { display: flex; gap: 10px; justify-content: center; margin: 24px 0; }
.otp-input {
  width: 48px; height: 56px; text-align: center; font-size: 22px; font-weight: 700;
  background: var(--bg2); border: 2px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-family: var(--font);
  transition: border-color 0.2s; outline: none;
}
.otp-input:focus { border-color: var(--accent); }
.otp-timer { text-align: center; color: var(--text2); font-size: 14px; margin-bottom: 16px; }

/* BUTTONS */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white; border: none; border-radius: var(--radius-sm);
  padding: 15px 28px; font-size: 16px; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: all 0.2s; text-align: center;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary.full { width: 100%; display: block; }
.btn-primary.full-w { width: 100%; }

.btn-secondary {
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 24px; font-size: 15px; font-weight: 500;
  cursor: pointer; transition: all 0.2s; font-family: var(--font);
}
.btn-secondary.full { width: 100%; }
.btn-ghost {
  background: none; color: var(--text2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 24px; font-size: 15px; cursor: pointer;
  transition: all 0.2s; font-family: var(--font);
}
.btn-ghost.full { width: 100%; margin-top: 10px; }
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- APP SHELL ---- */
#app-screen {
  flex-direction: column;
  background: var(--bg);
}

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 16px) + 12px) 20px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.user-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: white;
  flex-shrink: 0;
}
.user-avatar.large { width: 52px; height: 52px; font-size: 18px; }
.header-greeting { font-size: 12px; color: var(--text3); }
.header-name { font-size: 15px; font-weight: 600; color: var(--text); }
.header-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: var(--card2); border: none; border-radius: 50%;
  color: var(--text2); cursor: pointer; position: relative;
}
.notif-dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); border: 2px solid var(--bg);
}

.app-main {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding-bottom: 90px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.page { display: none; padding: 0 0 16px; }
.page.active { display: block; animation: pageIn 0.3s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: translateX(0); } }

.page-title-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 4px;
}
.page-title-row h2 { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.add-fab-inline {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white; border: none; border-radius: 100px;
  padding: 8px 18px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: var(--font);
}

/* NET WORTH CARD */
.net-worth-card {
  margin: 16px 20px; padding: 24px;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
  border-radius: 20px;
  position: relative; overflow: hidden;
}
.net-worth-card::before {
  content: ''; position: absolute;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,0.05);
  top: -60px; right: -40px;
}
.nw-label { font-size: 13px; color: rgba(255,255,255,0.65); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.nw-amount { font-family: var(--font-display); font-size: 36px; font-weight: 800; color: white; margin-bottom: 6px; }
.nw-change { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; background: rgba(255,255,255,0.1); padding: 4px 10px; border-radius: 100px; color: rgba(255,255,255,0.9); margin-bottom: 20px; }
.nw-change.positive { color: #4ade80; }
.nw-change.negative { color: #f87171; }
.nw-bars { display: flex; align-items: flex-end; gap: 4px; height: 48px; }
.nw-bar { flex: 1; border-radius: 4px 4px 0 0; background: rgba(255,255,255,0.2); transition: height 0.5s ease; }
.nw-bar.current { background: rgba(255,255,255,0.7); }

/* QUICK STATS */
.quick-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 20px 8px; }
.qstat-card { background: var(--card); border-radius: var(--radius-sm); padding: 14px; border: 1px solid var(--border); }
.qstat-label { font-size: 12px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.qstat-val { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.qstat-card.income .qstat-val { color: var(--green); }
.qstat-card.expense .qstat-val { color: var(--red); }
.qstat-card.savings .qstat-val { color: var(--blue); }
.qstat-card.invest .qstat-val { color: var(--yellow); }

/* SECTION HEADERS */
.section-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 10px; }
.section-header h3 { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.see-all { background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; font-family: var(--font); }

/* TRANSACTIONS */
.txn-list { padding: 0 20px; }
.txn-list.padded { padding: 0 20px; }
.txn-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
  animation: fadeIn 0.3s ease;
}
.txn-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.txn-info { flex: 1; min-width: 0; }
.txn-desc { font-size: 15px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-cat { font-size: 12px; color: var(--text3); margin-top: 2px; }
.txn-right { text-align: right; flex-shrink: 0; }
.txn-amount { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.txn-amount.income { color: var(--green); }
.txn-amount.expense { color: var(--red); }
.txn-amount.investment { color: var(--yellow); }
.txn-date { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* FILTER TABS */
.filter-tabs { display: flex; gap: 8px; padding: 12px 20px; overflow-x: auto; scrollbar-width: none; }
.filter-tabs::-webkit-scrollbar { display: none; }
.ftab {
  padding: 7px 16px; border-radius: 100px; font-size: 14px; font-weight: 500;
  background: var(--card2); border: 1px solid var(--border); color: var(--text2);
  cursor: pointer; white-space: nowrap; flex-shrink: 0; font-family: var(--font);
  transition: all 0.2s;
}
.ftab.active { background: var(--accent); color: white; border-color: var(--accent); }

/* MONTH SUMMARY BAR */
.month-summary-bar {
  margin: 4px 20px 12px;
  background: var(--card); border-radius: var(--radius-sm); border: 1px solid var(--border);
  padding: 16px; display: flex; align-items: center; justify-content: space-around;
}
.msb-label { font-size: 11px; color: var(--text3); text-transform: uppercase; text-align: center; }
.msb-income { font-weight: 700; color: var(--green); font-size: 15px; text-align: center; margin-top: 2px; }
.msb-expense { font-weight: 700; color: var(--red); font-size: 15px; text-align: center; margin-top: 2px; }
.msb-balance { font-weight: 700; color: var(--blue); font-size: 15px; text-align: center; margin-top: 2px; }
.vsep { width: 1px; height: 36px; background: var(--border); }

/* WEALTH */
.wealth-overview { padding: 12px 20px; display: flex; gap: 16px; align-items: center; }
.wealth-pie { width: 130px; height: 130px; flex-shrink: 0; }
.wealth-breakdown { flex: 1; }
.wb-item { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.wb-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.wb-label { font-size: 13px; color: var(--text2); flex: 1; }
.wb-pct { font-size: 13px; font-weight: 600; }

.asset-list, .liability-list { padding: 0 20px; }
.asset-item {
  background: var(--card); border-radius: var(--radius-sm); border: 1px solid var(--border);
  padding: 14px; margin-bottom: 10px; animation: fadeIn 0.3s ease;
}
.asset-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.asset-name { font-weight: 600; font-size: 15px; }
.asset-type { font-size: 12px; color: var(--text3); }
.asset-values { display: flex; justify-content: space-between; }
.asset-val { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.asset-gain { font-size: 12px; margin-top: 2px; }
.asset-gain.positive { color: var(--green); }
.asset-gain.negative { color: var(--red); }

/* GOALS */
.goals-mini { padding: 0 20px; display: flex; flex-direction: column; gap: 10px; }
.goal-mini-card { background: var(--card); border-radius: var(--radius-sm); border: 1px solid var(--border); padding: 14px; }
.goal-mini-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.goal-mini-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.goal-mini-pct { font-size: 13px; color: var(--text2); }
.goal-progress { height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.goal-bar { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width 0.6s ease; }
.goal-amounts { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--text3); }

.goals-full-list { padding: 12px 20px; display: flex; flex-direction: column; gap: 12px; }
.goal-card {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 18px; animation: fadeIn 0.3s ease;
}
.goal-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.goal-emoji { font-size: 28px; }
.goal-info h4 { font-size: 16px; font-weight: 600; }
.goal-info p { font-size: 13px; color: var(--text3); }
.goal-stats { display: flex; justify-content: space-between; margin-bottom: 10px; }
.goal-stat-label { font-size: 12px; color: var(--text3); }
.goal-stat-val { font-weight: 700; font-size: 15px; }
.goal-progress-full { height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; }

/* CATEGORY CHART */
.category-chart { padding: 0 20px 8px; display: flex; flex-direction: column; gap: 8px; }
.cat-item { display: flex; align-items: center; gap: 10px; }
.cat-label { width: 90px; font-size: 13px; color: var(--text2); flex-shrink: 0; }
.cat-bar-wrap { flex: 1; height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; }
.cat-bar { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.cat-amount { font-size: 13px; font-weight: 600; width: 70px; text-align: right; flex-shrink: 0; }

/* DAILY LIFE */
.life-tabs { display: flex; gap: 0; padding: 12px 20px 0; border-bottom: 1px solid var(--border); }
.ltab {
  flex: 1; padding: 10px 0; font-size: 14px; font-weight: 500;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text2); cursor: pointer; font-family: var(--font);
  transition: all 0.2s;
}
.ltab.active { color: var(--accent); border-bottom-color: var(--accent); }

.life-panel { display: none; padding: 16px 20px; }
.life-panel.active { display: block; }

.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: var(--radius-sm);
  border: 1px solid var(--border); padding: 14px;
  animation: fadeIn 0.3s ease; cursor: pointer;
  transition: all 0.2s;
}
.task-item.done { opacity: 0.5; }
.task-item.done .task-text { text-decoration: line-through; }
.task-check {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border); display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.task-item.done .task-check { background: var(--green); border-color: var(--green); }
.task-item.done .task-check::after { content: '✓'; color: white; font-size: 12px; }
.task-text { flex: 1; font-size: 15px; }
.task-priority { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.task-priority.high { background: var(--red); }
.task-priority.medium { background: var(--yellow); }
.task-priority.low { background: var(--green); }

.habit-list { display: flex; flex-direction: column; gap: 8px; }
.habit-item {
  background: var(--card); border-radius: var(--radius-sm); border: 1px solid var(--border); padding: 14px;
}
.habit-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.habit-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.habit-streak { font-size: 13px; color: var(--yellow); font-weight: 600; }
.habit-days { display: flex; gap: 6px; }
.habit-day { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; background: var(--bg3); color: var(--text3); cursor: pointer; font-weight: 500; transition: all 0.2s; }
.habit-day.done { background: var(--accent); color: white; }

.notes-list { display: flex; flex-direction: column; gap: 10px; }
.note-card {
  background: var(--card); border-radius: var(--radius-sm); border: 1px solid var(--border);
  padding: 14px; animation: fadeIn 0.3s ease;
}
.note-title { font-weight: 600; margin-bottom: 4px; }
.note-body { font-size: 14px; color: var(--text2); line-height: 1.6; }
.note-date { font-size: 12px; color: var(--text3); margin-top: 8px; }

.mood-tracker { }
.mood-title { font-weight: 600; margin-bottom: 16px; font-size: 16px; }
.mood-today { background: var(--card); border-radius: var(--radius-sm); border: 1px solid var(--border); padding: 20px; margin-bottom: 16px; }
.mood-q { font-size: 15px; color: var(--text2); margin-bottom: 16px; text-align: center; }
.mood-options { display: flex; justify-content: space-around; }
.mood-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; padding: 8px; border-radius: 10px; transition: all 0.2s; }
.mood-opt:hover, .mood-opt.active { background: var(--bg3); }
.mood-emoji { font-size: 28px; }
.mood-label { font-size: 11px; color: var(--text3); }
.mood-history { }
.mood-hist-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.mood-hist-row { display: flex; gap: 6px; }
.mood-hist-day { flex: 1; background: var(--card); border-radius: 6px; border: 1px solid var(--border); padding: 8px 4px; text-align: center; }
.mood-hist-date { font-size: 10px; color: var(--text3); }
.mood-hist-emoji { font-size: 18px; }

/* BOTTOM NAV */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--card); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  padding: 8px 4px env(safe-area-inset-bottom, 8px);
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; color: var(--text3); cursor: pointer;
  padding: 4px 0; transition: all 0.2s; font-family: var(--font);
}
.nav-item.active { color: var(--accent); }
.nav-item span { font-size: 11px; font-weight: 500; }
.nav-item.fab-center { position: relative; }
.fab-btn {
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(99,102,241,0.5);
  margin-top: -24px;
  transition: all 0.2s;
}
.fab-btn:hover { transform: scale(1.05); }

/* MODALS */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 200;
  backdrop-filter: blur(4px);
  animation: overlayIn 0.2s ease;
}
.modal-overlay.active { display: block; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  display: none; position: fixed; z-index: 201;
  background: var(--card); border: 1px solid var(--border);
}
.modal.active { display: block; animation: modalIn 0.3s cubic-bezier(0.4,0,0.2,1); }

.bottom-sheet {
  left: 0; right: 0; bottom: 0;
  border-radius: 24px 24px 0 0;
  padding: 12px 24px env(safe-area-inset-bottom, 24px);
  max-height: 92vh; overflow-y: auto;
}
@keyframes modalIn { from { transform: translateY(100%); } to { transform: translateY(0); } }

.right-sheet {
  top: 0; right: 0; bottom: 0; width: 85%; max-width: 360px;
  border-radius: 0; padding: 0;
}
@keyframes rightIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.right-sheet.active { animation: rightIn 0.3s cubic-bezier(0.4,0,0.2,1); }

.modal-handle { width: 40px; height: 4px; background: var(--bg3); border-radius: 2px; margin: 0 auto 16px; }
.modal-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin-bottom: 20px; }

.type-toggle { display: flex; gap: 4px; background: var(--bg2); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 20px; }
.ttype-btn {
  flex: 1; padding: 9px; font-size: 13px; font-weight: 600;
  background: none; border: none; border-radius: 8px; color: var(--text2);
  cursor: pointer; font-family: var(--font); transition: all 0.2s;
}
.ttype-btn.active { background: var(--accent); color: white; }

.form-row { display: flex; gap: 12px; }
.form-group.half { flex: 1; min-width: 0; }

.quick-actions-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding-bottom: 8px; }
.qa-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--card2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px 8px; cursor: pointer; font-family: var(--font);
  color: var(--text); font-size: 13px; font-weight: 500;
  transition: all 0.2s;
}
.qa-btn:hover { background: var(--bg3); }
.qa-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; }

.emoji-picker-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.ep-opt { font-size: 24px; cursor: pointer; padding: 8px; border-radius: 10px; transition: all 0.2s; border: 2px solid transparent; }
.ep-opt.active { background: var(--bg3); border-color: var(--accent); }

/* SETTINGS */
.settings-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 16px; border-bottom: 1px solid var(--border); }
.settings-header h3 { font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.settings-header button { background: none; border: none; color: var(--text2); font-size: 18px; cursor: pointer; }
.settings-body { padding: 16px 20px; overflow-y: auto; height: calc(100% - 64px); }
.settings-section { margin-bottom: 24px; }
.settings-section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text3); margin-bottom: 12px; }
.settings-user-card { display: flex; align-items: center; gap: 14px; }
.settings-uname { font-weight: 600; font-size: 16px; }
.settings-uemail { font-size: 13px; color: var(--text3); }
.settings-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.settings-select { background: var(--bg3); border: none; color: var(--text); padding: 6px 10px; border-radius: 6px; font-family: var(--font); outline: none; }
.settings-btn { width: 100%; padding: 13px; background: var(--card2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 15px; cursor: pointer; font-family: var(--font); margin-bottom: 8px; text-align: left; }
.settings-btn.danger { color: var(--red); }
.toggle-switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--bg3); border-radius: 13px; transition: 0.3s; cursor: pointer; }
.toggle-slider::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: white; border-radius: 50%; transition: 0.3s; }
input:checked + .toggle-slider { background: var(--accent); }
input:checked + .toggle-slider::before { transform: translateX(22px); }

/* TOAST */
.toast {
  display: none; position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 100px;
  font-size: 14px; font-weight: 500; z-index: 500; white-space: nowrap;
  animation: toastIn 0.3s ease;
}
.toast.show { display: block; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

.mt16 { margin-top: 16px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text3); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 2px; }

/* ---- PWA Install Banner ---- */
.install-banner {
  position: fixed; bottom: 90px; left: 16px; right: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: var(--radius); padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  z-index: 150; box-shadow: 0 8px 24px rgba(99,102,241,0.4);
  animation: slideUp 0.4s ease;
}
.install-banner p { font-size: 14px; color: white; font-weight: 500; }
.install-banner-btns { display: flex; gap: 8px; }
.install-banner button { padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; border: none; cursor: pointer; font-family: var(--font); }
.btn-install { background: white; color: var(--accent); }
.btn-dismiss { background: rgba(255,255,255,0.2); color: white; }
