@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@400;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep: #0F172A;
  --bg-slate: #1E293B;
  --bg-card: #1A2540;
  --bg-glass: rgba(30, 41, 59, 0.7);
  --accent: #2563EB;
  --accent-light: #3B82F6;
  --accent-glow: rgba(37, 99, 235, 0.25);
  --success: #10B981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #F59E0B;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #EF4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --purple: #8B5CF6;
  --purple-bg: rgba(139, 92, 246, 0.12);
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border: rgba(255,255,255,0.07);
  --border-accent: rgba(37,99,235,0.3);
  --sidebar-width: 240px;
  --header-height: 68px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.45);
}

html { font-size: 15px; }
body {
  font-family: 'Inter', sans-serif;
  line-height: 1.4;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-slate); border-radius: 99px; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-slate);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  width: 44px; height: 44px;
  background: #111827;
  border: 1px solid rgba(245, 158, 11, .38);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .32);
  flex-shrink: 0;
}
.logo-icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.auth-brand-logo {
  display: block;
  width: 124px;
  height: 124px;
  margin: 0 auto 18px;
  object-fit: cover;
  border: 1px solid rgba(245, 158, 11, .3);
  border-radius: 20px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .4);
}
.login-logo .auth-brand-logo { margin-bottom: 0; }
.logo-text { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.03em; line-height: 1.2; }
.logo-sub { font-size: 0.65rem; color: var(--text-secondary); font-weight: 400; letter-spacing: 0.06em; text-transform: uppercase; }

.sidebar-section-label {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 18px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 2px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.18s ease;
  position: relative;
  text-decoration: none;
}
.nav-item:hover {
  background: rgba(37,99,235,0.1);
  color: var(--text-primary);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(37,99,235,0.22), rgba(124,58,237,0.1));
  color: var(--accent-light);
  box-shadow: inset 0 0 0 1px rgba(37,99,235,0.2);
}
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--border);
}
.family-members {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
}
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.avatar.lemar { background: linear-gradient(135deg, #2563EB, #7C3AED); }
.avatar.wife { background: linear-gradient(135deg, #EC4899, #F59E0B); }
.member-info { flex: 1; min-width: 0; }
.member-name { font-size: 0.75rem; font-weight: 600; }
.member-role { font-size: 0.62rem; color: var(--text-muted); }
.online-dot {
  width: 7px; height: 7px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--success);
}

/* ── MAIN LAYOUT ── */
.main-wrap {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── HEADER ── */
.header {
  height: var(--header-height);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-left { flex: 1; }
.header-greeting { font-size: 0.78rem; color: var(--text-secondary); }
.header-date { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-slate);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 7px 14px;
  width: 220px;
  transition: all 0.2s;
}
.search-bar:focus-within { border-color: var(--border-accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-bar input {
  background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 0.78rem;
  width: 100%; font-family: inherit;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-icon { color: var(--text-muted); font-size: 0.85rem; flex-shrink: 0; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-slate);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  position: relative;
  transition: all 0.18s;
}
.icon-btn:hover { background: rgba(37,99,235,0.15); color: var(--text-primary); border-color: var(--border-accent); }
.notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid var(--bg-deep);
}

.header-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563EB, #7C3AED);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid var(--border-accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ── PAGE CONTENT ── */
.content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  min-width: 0;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}
.notif-dot.hidden { display: none; }
.mobile-search-btn { display: none; }
.shared-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 6px;
  border-radius: 99px;
  background: rgba(37,99,235,0.14);
  color: var(--accent-light);
  font-size: 0.58rem;
  font-weight: 700;
  vertical-align: middle;
}
.portal-popover {
  display: none;
  position: fixed;
  top: 64px;
  right: 76px;
  z-index: 180;
  width: min(380px, calc(100vw - 24px));
  max-height: min(520px, calc(100vh - 84px));
  overflow-y: auto;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.38);
}
.portal-popover.open { display: block; }
.search-results { right: 156px; }
.search-result {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 3px;
  padding: 10px;
  text-align: left;
  color: var(--text-primary);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.search-result:hover { background: rgba(37,99,235,.1); }
.search-result-type { color: var(--accent-light); font-size: .62rem; text-transform: uppercase; letter-spacing: .05em; }
.search-result small, .notification-item small { display: block; color: var(--text-muted); font-size: .66rem; }
.popover-title { font-weight: 700; margin-bottom: 10px; color: var(--text-primary); }
.popover-empty { padding: 16px 8px; color: var(--text-secondary); font-size: .76rem; text-align: center; }
.notification-item { padding: 10px 4px; border-bottom: 1px solid var(--border); color: var(--text-secondary); font-size: .76rem; }
.notification-item strong { color: var(--text-primary); }

.page { display: none; }
.page.active { display: block; }

/* ── HERO ── */
.hero {
  background: linear-gradient(135deg, rgba(37,99,235,0.15) 0%, rgba(124,58,237,0.1) 50%, rgba(16,185,129,0.08) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(37,99,235,0.2) 0%, transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -40px; left: 30%;
  width: 150px; height: 150px;
  background: radial-gradient(circle, rgba(124,58,237,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.hero-eyebrow {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-light);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.hero-eyebrow::before { content: '●'; font-size: 0.5rem; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #F1F5F9 0%, #94A3B8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-quote {
  font-size: 0.83rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 20px;
  max-width: 500px;
}
.hero-stats { display: flex; gap: 32px; flex-wrap: wrap; }
.hero-stat-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.hero-stat-value { font-size: 1.1rem; font-weight: 700; }
.hero-stat-value.green { color: var(--success); }
.hero-stat-value.blue { color: var(--accent-light); }

/* ── SECTION HEADER ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.section-title .icon { font-size: 1rem; }
.section-action {
  font-size: 0.72rem;
  color: var(--accent-light);
  cursor: pointer;
  font-weight: 500;
}
.section-action:hover { text-decoration: underline; }

.section-header > .add-btn { margin-left: 8px; }

.load-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.activity-history-modal .editor-panel { max-width: 640px; }
.activity-history-list { max-height: min(65vh, 620px); overflow-y: auto; padding-right: 4px; }
.activity-history-list .activity-item { padding: 12px 2px; }

.past-events {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.past-events summary {
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 2px 12px;
}
.past-events summary:hover { color: var(--accent-light); }
.past-events-list { opacity: 0.78; }

/* ── GRID ── */
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }

/* ── CARD ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.card:hover {
  border-color: rgba(37,99,235,0.25);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.card-accent-top { position: absolute; top: 0; left: 0; right: 0; height: 2px; }

/* ── METRIC CARDS ── */
.metric-card { }
.metric-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.metric-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.metric-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 99px;
  display: flex; align-items: center; gap: 3px;
}
.badge-up { background: var(--success-bg); color: var(--success); }
.badge-down { background: var(--danger-bg); color: var(--danger); }
.badge-neutral { background: var(--warning-bg); color: var(--warning); }
.metric-value { font-size: 1.4rem; font-weight: 700; margin-bottom: 3px; line-height: 1; }
.metric-label { font-size: 0.7rem; color: var(--text-secondary); margin-bottom: 10px; }
.metric-progress-bar {
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 99px;
  overflow: hidden;
}
.metric-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 1s ease;
}

/* ── PROGRESS SECTION ── */
.progress-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 24px;
}
.progress-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.progress-subtitle { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 20px; }

.freedom-ring {
  display: flex; align-items: center; gap: 32px; flex-wrap: wrap;
}
.ring-wrap { position: relative; width: 110px; height: 110px; flex-shrink: 0; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-center {
  position: absolute;
  inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-pct { font-size: 1.3rem; font-weight: 700; line-height: 1; }
.ring-label { font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase; margin-top: 2px; letter-spacing: 0.06em; }

.progress-bars { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 16px; }
.pbar-row { }
.pbar-header { display: flex; justify-content: space-between; margin-bottom: 6px; }
.pbar-name { font-size: 0.78rem; font-weight: 500; }
.pbar-value { font-size: 0.78rem; color: var(--text-secondary); }
.pbar {
  height: 8px;
  background: rgba(255,255,255,0.07);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}
.pbar-fill {
  height: 100%;
  border-radius: 99px;
  position: relative;
  transition: width 1.2s ease;
}
.pbar-fill::after {
  content: '';
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  width: 10px; height: 10px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255,255,255,0.5);
}
.milestone-dots { display: flex; gap: 6px; margin-top: 6px; }
.milestone { width: 7px; height: 7px; border-radius: 50%; }

/* ── CHARTS ── */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.chart-header { margin-bottom: 14px; }
.chart-title { font-size: 0.82rem; font-weight: 600; }
.chart-subtitle { font-size: 0.68rem; color: var(--text-secondary); margin-top: 2px; }
canvas { max-height: 160px; }

/* ── BILLS ── */
.bill-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: all 0.18s;
}
.bill-item:hover { background: rgba(37,99,235,0.06); border-color: rgba(37,99,235,0.15); }
.bill-icon { font-size: 1.1rem; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px; flex-shrink: 0; }
.bill-name { font-size: 0.82rem; font-weight: 500; }
.bill-due { font-size: 0.68rem; color: var(--text-muted); margin-top: 1px; }
.bill-amount { margin-left: auto; text-align: right; }
.bill-amt { font-size: 0.88rem; font-weight: 600; }
.bill-status { font-size: 0.62rem; font-weight: 600; padding: 2px 7px; border-radius: 99px; margin-top: 2px; display: inline-block; }
.status-upcoming { background: var(--warning-bg); color: var(--warning); }
.status-paid { background: var(--success-bg); color: var(--success); }
.status-overdue { background: var(--danger-bg); color: var(--danger); }

/* ── ACTIVITY FEED ── */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.activity-text { font-size: 0.78rem; line-height: 1.4; }
.activity-time { font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; }
.activity-who { font-weight: 600; }

/* ── VISION BOARD ── */
.vision-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.22s ease;
  cursor: pointer;
}
.vision-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: rgba(37,99,235,0.3); }
.vision-img {
  height: 110px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  position: relative;
  overflow: hidden;
}
.vision-img::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(15,23,42,0.7));
}
.vision-body { padding: 14px; }
.vision-name { font-size: 0.82rem; font-weight: 600; margin-bottom: 2px; }
.vision-msg { font-size: 0.67rem; color: var(--text-secondary); margin-bottom: 10px; font-style: italic; }
.vision-amounts { display: flex; justify-content: space-between; margin-bottom: 6px; }
.vision-current { font-size: 0.7rem; color: var(--text-secondary); }
.vision-target { font-size: 0.7rem; font-weight: 600; color: var(--text-primary); }
.vision-bar { height: 5px; background: rgba(255,255,255,0.07); border-radius: 99px; overflow: hidden; margin-bottom: 4px; }
.vision-fill { height: 100%; border-radius: 99px; }
.vision-pct { font-size: 0.65rem; color: var(--text-muted); text-align: right; }

/* ── DEBT PAGE ── */
.debt-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  transition: all 0.18s;
}
.debt-card:hover { border-color: rgba(37,99,235,0.2); transform: translateY(-1px); }
.debt-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.debt-icon { font-size: 1.4rem; }
.debt-name { font-size: 0.9rem; font-weight: 600; }
.debt-type { font-size: 0.68rem; color: var(--text-muted); }
.debt-badge { margin-left: auto; font-size: 0.7rem; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--danger-bg); color: var(--danger); }
.debt-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.debt-stat-label { font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.debt-stat-val { font-size: 0.9rem; font-weight: 600; }
.debt-prog-label { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 0.72rem; color: var(--text-secondary); }
.debt-bar { height: 10px; background: rgba(255,255,255,0.07); border-radius: 99px; overflow: hidden; }
.debt-bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--danger), var(--warning)); }

/* ── SAVINGS GOAL CARDS ── */
.goal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  transition: all 0.2s;
}
.goal-card:hover { border-color: rgba(16,185,129,0.3); transform: translateY(-2px); box-shadow: var(--shadow); }
.goal-circle { position: relative; width: 90px; height: 90px; margin-bottom: 14px; }
.goal-circle svg { transform: rotate(-90deg); }
.goal-pct-center {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700;
}
.goal-name { font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; }
.goal-amounts { font-size: 0.72rem; color: var(--text-secondary); margin-bottom: 12px; }
.goal-milestone { font-size: 0.65rem; color: var(--success); font-weight: 500; background: var(--success-bg); padding: 3px 8px; border-radius: 99px; margin-bottom: 8px; }
.goal-date { font-size: 0.65rem; color: var(--text-muted); }
.vision-goal-card { min-height: 310px; }
.vision-goal-emoji { margin-bottom: 8px; font-size: 1.35rem; }
.vision-edit-button { width: 100%; min-height: 36px; margin-top: auto; font-size: .7rem; }
.vision-empty {
  grid-column: 1 / -1;
  padding: 24px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, .018);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: .76rem;
  text-align: center;
}

/* ── KANBAN ── */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
.kanban-col {
  background: rgba(30,41,59,0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 300px;
  min-width: 0;
}
.bill-item .record-actions { flex-basis: 100%; margin-left: 44px; margin-top: 2px; }
.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.kanban-col-title { font-size: 0.78rem; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.col-count { font-size: 0.65rem; background: rgba(255,255,255,0.1); padding: 2px 7px; border-radius: 99px; color: var(--text-secondary); }
.kanban-task {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  cursor: grab;
  transition: all 0.18s;
  min-width: 0;
}
.kanban-task:hover { border-color: rgba(37,99,235,0.25); box-shadow: var(--shadow); }
.task-title { font-size: 0.78rem; font-weight: 500; margin-bottom: 6px; overflow-wrap: anywhere; }
.task-cat { font-size: 0.6rem; font-weight: 600; padding: 2px 7px; border-radius: 99px; display: inline-block; margin-bottom: 6px; }
.cat-personal { background: rgba(139,92,246,0.15); color: var(--purple); }
.cat-financial { background: var(--success-bg); color: var(--success); }
.cat-business { background: rgba(37,99,235,0.15); color: var(--accent-light); }
.cat-family { background: rgba(245,158,11,0.15); color: var(--warning); }
.task-due { font-size: 0.65rem; color: var(--text-muted); }

/* ── CALENDAR ── */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day-label { text-align: center; font-size: 0.65rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; padding: 6px 0; }
.cal-day {
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 0.78rem;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
  padding: 4px;
}
.cal-day:hover { background: rgba(255,255,255,0.06); }
.cal-day.today { background: var(--accent); font-weight: 700; box-shadow: 0 0 14px var(--accent-glow); }
.cal-day.other-month { color: var(--text-muted); }
.cal-day.has-event::after {
  content: ''; position: absolute; bottom: 4px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--success);
}
.cal-day.has-bill::after { background: var(--warning); }

/* ── DOCUMENT VAULT ── */
.doc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: block;
  transition: all 0.18s;
  margin-bottom: 10px;
}
.doc-card:hover { border-color: rgba(37,99,235,0.25); background: rgba(37,99,235,0.05); }
.doc-card-main { min-width: 0; }
.doc-icon { font-size: 1.6rem; }
.doc-name { color: var(--text-primary); font-size: 0.84rem; font-weight: 700; overflow-wrap: anywhere; }
.doc-meta { color: var(--text-muted); font-size: 0.68rem; line-height: 1.45; margin-top: 4px; overflow-wrap: anywhere; }
.doc-card .record-actions {
  align-items: stretch;
  justify-content: flex-end;
  width: 100%;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.doc-card .record-actions > * {
  min-width: 86px;
  min-height: 36px;
  margin: 0;
  text-decoration: none;
}
.doc-expiry { margin-left: auto; text-align: right; }
.doc-exp-date { font-size: 0.7rem; font-weight: 500; }
.doc-exp-label { font-size: 0.6rem; color: var(--text-muted); }

/* ── PROJECTS ── */
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: all 0.18s;
}
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: rgba(37,99,235,0.2); }
.project-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.project-icon { font-size: 1.3rem; }
.project-name { font-size: 0.85rem; font-weight: 600; }
.project-client { font-size: 0.68rem; color: var(--text-muted); }
.project-status { margin-left: auto; font-size: 0.65rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; }
.status-active { background: var(--success-bg); color: var(--success); }
.status-pending { background: var(--warning-bg); color: var(--warning); }
.status-review { background: var(--purple-bg); color: var(--purple); }
.project-amount { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; color: var(--success); }
.project-due { font-size: 0.68rem; color: var(--text-muted); margin-bottom: 10px; }
.project-bar { height: 5px; background: rgba(255,255,255,0.07); border-radius: 99px; overflow: hidden; }
.project-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--success)); }

/* ── SETTINGS ── */
.settings-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 14px; }
.settings-section-title { font-size: 0.82rem; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.setting-row > div:first-child { min-width: 0; }
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 0.8rem; font-weight: 500; }
.setting-desc { font-size: 0.68rem; color: var(--text-muted); margin-top: 2px; }
.toggle {
  width: 40px; height: 22px;
  background: var(--accent);
  border-radius: 99px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 3px; right: 3px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  transition: all 0.2s;
}
.toggle.off { background: var(--text-muted); }
.toggle.off::after { right: auto; left: 3px; }

/* ── PAGE TITLES ── */
.page-header { margin-bottom: 22px; }
.page-title { font-family: 'Playfair Display', serif; font-size: 1.5rem; font-weight: 700; }
.page-desc { font-size: 0.78rem; color: var(--text-secondary); margin-top: 4px; }

/* ── MOBILE ── */
.mobile-menu-btn { display: none; }

@media (max-width: 1200px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .kanban { grid-template-columns: repeat(2, 1fr); }
  .debt-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap {
    margin-left: 0;
    width: 100%;
    flex-basis: 100%;
  }
  .mobile-menu-btn { display: flex; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
  .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kanban { grid-template-columns: 1fr; }
  .search-bar { display: none; }
  .hero {
    padding: 18px;
    overflow: visible;
  }
  .hero-title { font-size: 1.4rem; }
  .freedom-ring { flex-direction: column; }
}

/* ── STRATEGY TABS ── */
.tab-row { display: flex; gap: 8px; margin-bottom: 20px; }
.tab-btn {
  padding: 7px 16px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: transparent;
  transition: all 0.18s;
  font-family: inherit;
}
.tab-btn:hover { border-color: var(--border-accent); color: var(--text-primary); }
.tab-btn.active { background: var(--accent); border-color: var(--accent); color: white; box-shadow: 0 0 12px var(--accent-glow); }

/* ── MONTH PILLS ── */
.month-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.month-label { font-size: 0.9rem; font-weight: 600; flex: 1; text-align: center; }
.month-btn { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-slate); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 0.75rem; color: var(--text-secondary); transition: all 0.15s; }
.month-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }

/* ── INLINE ADD BTN ── */
.add-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-align: center;
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.add-btn:hover { background: var(--accent-light); transform: translateY(-1px); }

/* ── OVERLAY ── */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; display: none; backdrop-filter: blur(2px); }
.overlay.open { display: block; }

/* ── NET WORTH BADGE ── */
.nw-positive { color: var(--success); }
.nw-negative { color: var(--danger); }

/* Modal editor */
.editor-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(6px);
}
.editor-modal.open { display: flex; }
.editor-panel {
  width: min(760px, 100%);
  max-height: min(88vh, 820px);
  overflow: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 22px 70px rgba(0,0,0,0.48);
}
.editor-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.editor-title { font-size: 1rem; font-weight: 700; }
.editor-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-slate);
  color: var(--text-primary);
  cursor: pointer;
}
.editor-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 20px;
}
.editor-field.full { grid-column: 1 / -1; }
.editor-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.editor-field input,
.editor-field select,
.editor-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-slate);
  color: var(--text-primary);
  padding: 10px 12px;
  font: inherit;
  font-size: 0.86rem;
}
.editor-field textarea { min-height: 88px; resize: vertical; }
.editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
}
.financial-wizard-panel { width: min(680px, 100%); }
.wizard-step-label {
  margin-bottom: 3px;
  color: var(--accent-light);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.wizard-progress {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  padding: 16px 20px 0;
}
.wizard-dot {
  height: 5px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.18);
  transition: background .2s ease, transform .2s ease;
}
.wizard-dot.active {
  background: linear-gradient(90deg, var(--accent), var(--success));
  transform: scaleY(1.15);
}
.wizard-description {
  margin: 12px 20px 0;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.55;
}
.wizard-review {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px solid rgba(16, 185, 129, .25);
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, .07);
  text-align: center;
}
.wizard-review .confirm-icon {
  color: var(--success);
  background: rgba(16, 185, 129, .14);
  border-color: rgba(16, 185, 129, .3);
}
.wizard-review strong { display: block; margin-bottom: 8px; }
.wizard-review p { margin: 0; color: var(--text-secondary); font-size: .8rem; line-height: 1.55; }
.wizard-review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
  text-align: left;
}
.wizard-review-grid > div {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(15, 23, 42, .45);
}
.wizard-review-grid span { display: block; margin-bottom: 4px; color: var(--text-muted); font-size: .66rem; }
.wizard-review-grid b { color: var(--text-primary); font-size: .9rem; }
.section-action-button {
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}
.confirm-panel {
  width: min(430px, 100%);
  padding: 26px;
  overflow: visible;
  text-align: center;
}
.confirm-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  color: #FCA5A5;
  background: rgba(239,68,68,.14);
  border: 1px solid rgba(239,68,68,.3);
  font-size: 1.45rem;
  font-weight: 800;
}
.confirm-content p {
  margin: 9px auto 4px;
  max-width: 330px;
  color: var(--text-secondary);
  font-size: .78rem;
  line-height: 1.6;
}
.confirm-actions {
  justify-content: center;
  padding: 22px 0 0;
}
.danger-btn {
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid rgba(239,68,68,.65);
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, #EF4444, #DC2626);
  box-shadow: 0 8px 20px rgba(239,68,68,.18);
  font: inherit;
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
}
.danger-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(239,68,68,.28); }
.toast-container {
  position: fixed;
  top: 74px;
  right: 18px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 24px));
  pointer-events: none;
}
.app-toast {
  display: grid;
  grid-template-columns: 30px 1fr 26px;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  color: var(--text-primary);
  background: rgba(26,37,64,.98);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 46px rgba(0,0,0,.34);
  opacity: 0;
  transform: translateY(-8px) scale(.98);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: auto;
}
.app-toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast-icon { display:grid;place-items:center;width:28px;height:28px;border-radius:50%;font-weight:800;background:rgba(37,99,235,.16);color:var(--accent-light); }
.toast-success { border-color: rgba(16,185,129,.35); }
.toast-success .toast-icon { background:rgba(16,185,129,.15);color:#6EE7B7; }
.toast-error { border-color: rgba(239,68,68,.4); }
.toast-error .toast-icon { background:rgba(239,68,68,.15);color:#FCA5A5; }
.toast-warning .toast-icon { background:rgba(245,158,11,.15);color:#FCD34D; }
.toast-message { font-size:.76rem;line-height:1.45; }
.toast-close { border:0;background:transparent;color:var(--text-muted);font-size:1.2rem;cursor:pointer; }
.today-header { display:flex;align-items:flex-start;justify-content:space-between;gap:16px; }
.today-summary { margin-bottom:20px; }
.today-stat { display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px; }
.today-stat span { color:var(--text-secondary);font-size:.72rem; }
.today-stat strong { color:var(--accent-light);font-size:1.45rem; }
.today-grid { align-items:start; }
.today-section { padding:18px; }
.today-list { display:flex;flex-direction:column;gap:8px; }
.today-item { display:flex;align-items:center;gap:10px;padding:11px;border:1px solid var(--border);border-radius:10px;background:rgba(255,255,255,.018); }
.today-item.is-complete { opacity:.72; }
.today-item-icon { display:grid;place-items:center;flex:0 0 32px;width:32px;height:32px;border-radius:9px;background:rgba(37,99,235,.12); }
.today-item-content { min-width:0;flex:1; }
.today-item-content strong { display:block;color:var(--text-primary);font-size:.78rem; }
.today-item-content small { display:block;margin-top:3px;color:var(--text-muted);font-size:.65rem; }
.today-item-content .metric-progress-bar { margin:7px 0 4px; }
.today-item-actions { display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end; }
.today-item-actions .add-btn,.today-item-actions .secondary-btn { min-height:32px;padding:5px 9px;font-size:.65rem; }
.today-empty,.today-loading { padding:20px 8px;text-align:center;color:var(--text-muted);font-size:.73rem; }
.app-update-banner {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 480;
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(560px, calc(100vw - 24px));
  padding: 13px 14px;
  color: var(--text-primary);
  background: rgba(26,37,64,.98);
  border: 1px solid var(--border-accent);
  border-radius: 14px;
  box-shadow: 0 22px 60px rgba(0,0,0,.42);
  transform: translateX(-50%);
}
.app-update-banner > div { min-width:0;flex:1; }
.app-update-banner strong,.app-update-banner span { display:block; }
.app-update-banner strong { font-size:.8rem; }
.app-update-banner span { margin-top:2px;color:var(--text-secondary);font-size:.68rem; }
.update-dismiss { border:0;background:transparent;color:var(--text-muted);font-size:1.2rem;cursor:pointer; }

/* Mobile/PWA launch screen */
.app-loading-screen { display: none; }
@media (max-width: 1024px), (display-mode: standalone) {
  .app-loading-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    color: var(--text-primary);
    background:
      radial-gradient(circle at 50% 32%, rgba(245, 158, 11, .14), transparent 34%),
      radial-gradient(circle at 50% 70%, rgba(37, 99, 235, .13), transparent 40%),
      var(--bg-deep);
    opacity: 1;
    visibility: visible;
    transition: opacity .5s ease, visibility .5s ease;
  }
  .app-loading-screen.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
  .app-loading-content { width: min(100%, 340px); text-align: center; }
  .app-loading-logo {
    display: block;
    width: min(58vw, 248px);
    height: auto;
    margin: 0 auto 20px;
    border: 1px solid rgba(245, 158, 11, .28);
    border-radius: 24px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .52), 0 0 38px rgba(245, 158, 11, .12);
    animation: app-logo-arrive .65s ease both, app-logo-breathe 2.4s ease-in-out .7s infinite;
  }
  .app-loading-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: .02em;
  }
  .app-loading-message { margin-top: 6px; color: var(--text-secondary); font-size: .76rem; }
  .app-loading-dots { display: flex; justify-content: center; gap: 7px; margin-top: 18px; }
  .app-loading-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--warning);
    animation: app-loading-dot 1.15s ease-in-out infinite;
  }
  .app-loading-dots span:nth-child(2) { animation-delay: .16s; }
  .app-loading-dots span:nth-child(3) { animation-delay: .32s; }
}
@keyframes app-logo-arrive {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes app-logo-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.018); }
}
@keyframes app-loading-dot {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-5px); }
}
@media (prefers-reduced-motion: reduce) {
  .app-loading-logo,
  .app-loading-dots span { animation: none; }
  .app-loading-screen { transition-duration: .01ms; }
}

@media (max-width: 640px) {
  .toast-container { top: 66px; left: 12px; right: 12px; width: auto; }
  .today-header { align-items:center; }
  .today-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .today-item { align-items:flex-start; flex-wrap:wrap; }
  .today-item-actions { flex-basis:100%; padding-left:42px; justify-content:flex-start; }
  .today-item-actions .add-btn,.today-item-actions .secondary-btn { flex:1 1 auto; }
  .app-update-banner { align-items:flex-start; gap:10px; }
  .app-update-banner .add-btn { min-height:36px;white-space:nowrap; }
}
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-slate);
  color: var(--text-primary);
  border-radius: 99px;
  padding: 8px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  text-align: center;
}
.record-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.record-actions > .add-btn,
.record-actions > .secondary-btn,
.record-actions > .danger-btn {
  min-height: 34px;
  margin: 0;
  line-height: 1.2;
}

/* Shared layout rhythm and responsive control sizing */
img,
svg,
canvas { max-width: 100%; }
.page > :last-child { margin-bottom: 0; }
.hero-stats > div,
.grid-2 > *,
.grid-3 > *,
.grid-4 > *,
.grid-5 > * { min-width: 0; }
.add-btn,
.secondary-btn,
.danger-btn,
.tab-btn,
.icon-btn,
.month-btn {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.editor-field input,
.editor-field select { min-height: 42px; }
.section-header > :first-child { min-width: 0; }

.calendar-day-events {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-top: 3px;
}
.calendar-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
}
.install-btn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: none;
}
.install-btn.show { display: inline-flex; }

@media (max-width: 768px) {
  .content {
    padding: 16px;
    width: 100%;
  }
  body.sidebar-open { overflow: hidden; }
  body,
  .main-wrap,
  .content,
  .page {
    max-width: 100vw;
    overflow-x: hidden;
  }
  .header {
    padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
    gap: 8px;
  }
  .mobile-menu-btn {
    flex: 0 0 36px;
    margin-left: 0;
  }
  .header-left {
    min-width: 0;
    overflow: hidden;
  }
  .header-greeting,
  .header-date {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header .icon-btn:not(.mobile-menu-btn):not(.mobile-search-btn):not(#notification-button):not(form .icon-btn) {
    display: none;
  }
  .mobile-search-btn, #notification-button { display: flex; flex: 0 0 36px; }
  body.mobile-search-open #portal-search-bar {
    display: flex;
    position: fixed;
    top: 66px;
    left: 12px;
    right: 12px;
    z-index: 175;
    width: auto;
    background: var(--bg-card);
    box-shadow: 0 12px 36px rgba(0,0,0,.32);
  }
  .portal-popover, .search-results { top: 112px; left: 12px; right: 12px; width: auto; }
  .notification-panel { top: 64px; }
  .header-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.68rem;
  }
  .sidebar {
    width: min(86vw, var(--sidebar-width));
    transform: translateX(calc(-100% - 8px));
    z-index: 120;
    box-shadow: 18px 0 50px rgba(0,0,0,0.35);
  }
  .sidebar.open { transform: translateX(0); }
  .overlay { z-index: 110; }
  .page-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .page-title { font-size: 1.28rem; }
  .page-desc { font-size: 0.75rem; }
  .section-header {
    align-items: flex-start;
    gap: 8px;
    flex-direction: column;
  }
  .hero-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
  .hero-stat-label,
  .hero-stat-value,
  .metric-label,
  .metric-value {
    overflow-wrap: anywhere;
    word-break: normal;
  }
  .metric-value { font-size: 1.16rem; }
  .metric-card {
    min-height: 128px;
  }
  .metric-header {
    gap: 10px;
  }
  .metric-badge {
    white-space: nowrap;
  }
  .card,
  .chart-card,
  .progress-section,
  .settings-section {
    padding: 14px;
  }
  .bill-item,
.setting-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .bill-amount {
    margin-left: 0;
    text-align: left;
  }
  .record-actions {
    width: 100%;
  }
  .bill-item .record-actions { margin-left: 0; }
  .record-actions .add-btn,
  .record-actions .secondary-btn {
    flex: 1 1 auto;
    justify-content: center;
  }
  .add-btn,
  .secondary-btn {
    min-height: 38px;
  }
  .tab-row {
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: 4px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .tab-btn { white-space: nowrap; }
  .editor-modal {
    align-items: flex-end;
    padding: 0;
  }
  .editor-panel {
    width: 100%;
    max-height: 92vh;
    border-radius: 14px 14px 0 0;
  }
  .editor-body { grid-template-columns: 1fr; }
  .editor-actions {
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
  }
  .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .progress-bars {
    min-width: 0;
    width: 100%;
  }
  .pbar-header {
    flex-direction: column;
    gap: 4px;
  }
  .calendar-grid { gap: 3px; }
  .cal-day {
    min-height: 42px;
    font-size: 0.7rem;
  }
  .kanban {
    width: 100%;
    overflow: hidden;
  }
  .kanban-task {
    width: 100%;
    overflow: hidden;
  }
  .task-title,
  .task-due,
  .doc-name,
  .doc-meta {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}
.setting-input {
  width: min(240px, 100%);
  padding: 9px 12px;
  color: var(--text-primary);
  background: var(--bg-slate);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: .78rem;
  outline: none;
}
.setting-input:focus { border-color: var(--border-accent); box-shadow: 0 0 0 3px var(--accent-glow); }

@media (max-width: 520px) {
  .grid-5 { grid-template-columns: 1fr; }
  .wizard-review-grid { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .content { padding: 12px; }
  .header { min-width: 0; }
  .header-greeting { font-size: 0.74rem; }
  .header-date { font-size: 0.68rem; }
  .page-title { font-size: 1.18rem; }
  .hero {
    padding: 16px;
    border-radius: 12px;
  }
  .hero-title {
    font-size: 1.32rem;
  }
  .hero-quote {
    font-size: 0.78rem;
  }
  .add-btn,
  .secondary-btn {
    padding: 8px 12px;
  }
  .hero-stats { grid-template-columns: 1fr; }
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-5 {
    gap: 10px;
  }
  .editor-head,
  .editor-body,
  .editor-actions {
    padding-left: 14px;
    padding-right: 14px;
  }
  .wizard-progress { padding-left: 14px; padding-right: 14px; }
  .wizard-description { margin-left: 14px; margin-right: 14px; }
  .editor-actions {
    flex-direction: column-reverse;
  }
  .editor-actions .add-btn,
  .editor-actions .secondary-btn,
  .editor-actions .danger-btn {
    width: 100%;
  }
}

/* Final responsive overrides keep spacing and controls consistent site-wide. */
@media (max-width: 768px) {
  .content {
    max-width: 100%;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
  .page-header { margin-bottom: 18px; }
  .hero,
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-5,
  .kanban,
  .progress-section { margin-bottom: 18px; }
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-5,
  .kanban { gap: 12px; }
  .section-header {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .section-action { margin-left: auto; }
  .record-actions { width: 100%; }
  .record-actions > .add-btn,
  .record-actions > .secondary-btn,
  .record-actions > .danger-btn,
  .record-actions > .record-open {
    flex: 1 1 96px;
    min-height: 40px;
  }
  .doc-card { padding: 14px; }
  .doc-card .record-actions { justify-content: flex-start; }
  .setting-row { width: 100%; gap: 12px; }
  .setting-row .add-btn,
  .setting-row .secondary-btn,
  .setting-row .setting-input { max-width: 100%; }
  .setting-row > .add-btn,
  .setting-row > .secondary-btn,
  .setting-row > input,
  .setting-row > select { width: 100% !important; }
  .editor-field input,
  .editor-field select,
  .editor-field textarea,
  .setting-input,
  .setting-row input,
  .search-bar input { font-size: 16px; }
  .editor-actions { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}

@media (max-width: 430px) {
  .content {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .auth-brand-logo { width: 104px; height: 104px; border-radius: 17px; }
}

/* Monthly bill history and amount-entry states. */
.section-header-actions { display:flex;align-items:center;gap:10px;margin-left:auto; }
.bill-status.status-needs_amount,
.bill-history-status.status-needs_amount { color:#FCD34D;background:rgba(245,158,11,.14); }
.bill-history { display:grid;gap:16px; }
.bill-history-month { overflow:hidden;border:1px solid var(--border);border-radius:12px;background:var(--bg-slate); }
.bill-history-heading { display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;border-bottom:1px solid var(--border); }
.bill-history-heading strong { color:var(--text-primary);font-size:.88rem; }
.bill-history-heading span { color:var(--text-secondary);font-size:.7rem;text-align:right; }
.bill-history-row { display:flex;align-items:center;justify-content:space-between;gap:14px;padding:12px 14px;border-bottom:1px solid var(--border); }
.bill-history-row:last-child { border-bottom:0; }
.bill-history-row strong,.bill-history-row small { display:block; }
.bill-history-row strong { color:var(--text-primary);font-size:.78rem; }
.bill-history-row small { margin-top:3px;color:var(--text-muted);font-size:.68rem; }
.bill-history-value { display:grid;justify-items:end;gap:5px;white-space:nowrap; }
.bill-history-value > span { color:var(--text-primary);font-weight:700;font-size:.8rem; }
.bill-history-status { padding:3px 7px;border-radius:99px;color:var(--text-secondary);background:rgba(148,163,184,.12);font-size:.62rem;font-style:normal; }
.bill-history-status.status-paid { color:#6EE7B7;background:rgba(16,185,129,.14); }
.history-loading { padding:24px;text-align:center;color:var(--text-secondary); }

@media (max-width: 520px) {
  .section-header-actions { width:100%;margin-left:0;justify-content:flex-end; }
  .bill-history-heading,.bill-history-row { align-items:flex-start; }
  .bill-history-heading { flex-direction:column; }
  .bill-history-heading span { text-align:left; }
}
