:root {
  --life-ink: #172033;
  --life-muted: #738096;
  --life-soft: #f4f7fb;
  --life-panel: #ffffff;
  --life-line: #e2e8f0;
  --life-blue: #0d6efd;
  --life-teal: #0f9f9a;
  --life-rose: #d94873;
  --life-amber: #d9902f;
  --life-green: #198754;
  --life-sidebar: #101b2d;
  --life-sidebar-soft: #192940;
  --life-shadow: 0 14px 35px rgba(20, 37, 63, .08);
  --life-shadow-lg: 0 24px 60px rgba(20, 37, 63, .14);
}

[data-theme="dark"] {
  --life-ink: #edf4ff;
  --life-muted: #9eabc0;
  --life-soft: #0d1727;
  --life-panel: #142237;
  --life-line: #263750;
  --life-sidebar: #08111f;
  --life-sidebar-soft: #172941;
  --life-shadow: 0 14px 35px rgba(0, 0, 0, .2);
  --life-shadow-lg: 0 24px 60px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--life-ink);
  background: var(--life-soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
::selection { color: #fff; background: var(--life-blue); }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 3000; padding: .7rem 1rem; color: #fff; background: var(--life-blue); border-radius: 8px; }
.skip-link:focus { top: 1rem; }

.life-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1045;
  width: 276px;
  color: #dbe7f8;
  background: linear-gradient(180deg, #101d31 0%, var(--life-sidebar) 100%);
  border-right: 1px solid rgba(255,255,255,.08);
  transition: transform .25s ease;
}
.life-sidebar .offcanvas-header { display: none; }
.sidebar-inner { display: flex; height: 100%; flex-direction: column; padding: 1.35rem 1rem 1rem; overflow-y: auto; }
.life-brand { display: flex; align-items: center; gap: .75rem; padding: .25rem .65rem 1.7rem; color: #fff; }
.life-brand-mark { display: grid; width: 40px; height: 40px; place-items: center; color: #fff; font-weight: 850; background: linear-gradient(135deg, var(--life-blue), var(--life-teal)); border-radius: 10px; box-shadow: 0 10px 24px rgba(13,110,253,.3); }
.life-brand strong { display: block; font-size: 1rem; letter-spacing: .1em; }
.life-brand small { display: block; color: #8fa5c4; font-size: .67rem; letter-spacing: .11em; text-transform: uppercase; }
.side-label { margin: 1.05rem .75rem .45rem; color: #7f95b4; font-size: .65rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.life-nav { display: grid; gap: .2rem; }
.life-nav a { display: flex; align-items: center; gap: .75rem; min-height: 42px; padding: .55rem .75rem; color: #afc0d8; border-left: 3px solid transparent; border-radius: 7px; transition: color .2s ease, background .2s ease, border-color .2s ease, transform .2s ease; }
.life-nav a i { width: 1.25rem; color: #87a5cc; font-size: 1rem; text-align: center; transition: transform .2s ease, color .2s ease; }
.life-nav a:hover, .life-nav a.active { color: #fff; background: var(--life-sidebar-soft); border-left-color: #6eb5ff; }
.life-nav a:hover { transform: translateX(2px); }
.life-nav a:hover i, .life-nav a.active i { color: #73c8c2; transform: translateX(2px); }
.life-sidebar-footer { margin-top: auto; padding: 1rem .4rem 0; }
.sidebar-note { padding: .8rem; color: #9eb0c9; font-size: .75rem; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); border-radius: 8px; }
.sidebar-note i { color: #74d4c9; }

.life-app { min-height: 100vh; margin-left: 276px; }
.life-topbar { position: sticky; top: 0; z-index: 1020; min-height: 78px; display: flex; align-items: center; padding: .9rem 2.2rem; background: color-mix(in srgb, var(--life-panel) 92%, transparent); border-bottom: 1px solid var(--life-line); backdrop-filter: blur(16px); transition: box-shadow .2s ease; }
.life-topbar.scrolled { box-shadow: var(--life-shadow); }
.mobile-sidebar-toggle { display: none; }
.page-heading h1 { margin: 0; font-size: 1.25rem; font-weight: 800; }
.breadcrumb { margin: .1rem 0 0; color: var(--life-muted); font-size: .78rem; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--life-muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .65rem; }
.topbar-icon { display: grid; width: 42px; height: 42px; place-items: center; color: var(--life-muted); background: var(--life-soft); border: 1px solid var(--life-line); border-radius: 8px; transition: color .2s ease, border-color .2s ease, transform .2s ease; }
.topbar-icon:hover { color: var(--life-blue); border-color: var(--life-blue); transform: translateY(-2px); }
.topbar-profile { display: flex; align-items: center; gap: .65rem; padding: .2rem .25rem .2rem .75rem; background: transparent; border: 0; color: var(--life-ink); }
.avatar { display: grid; width: 38px; height: 38px; place-items: center; color: #fff; font-size: .8rem; font-weight: 800; background: linear-gradient(135deg, var(--life-blue), var(--life-teal)); border-radius: 50%; }
.profile-copy { line-height: 1.2; text-align: left; }
.profile-copy strong { display: block; font-size: .83rem; }
.profile-copy small { color: var(--life-muted); font-size: .68rem; }
.dropdown-menu { padding: .45rem; color: var(--life-ink); background: var(--life-panel); border-color: var(--life-line); box-shadow: var(--life-shadow-lg); }
.dropdown-item { border-radius: 6px; }
.dropdown-item:hover { color: var(--life-blue); background: var(--life-soft); }

.life-content { max-width: 1540px; margin: 0 auto; padding: 2rem 2.2rem 3.5rem; }
.life-footer { max-width: 1540px; margin: 0 auto; }
.welcome-band { position: relative; overflow: hidden; padding: 2rem; color: #fff; background: linear-gradient(135deg, #102640, #0c7180); border-radius: 12px; box-shadow: var(--life-shadow-lg); }
.welcome-band::after { content: ""; position: absolute; width: 260px; height: 260px; right: -90px; bottom: -145px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; box-shadow: 0 0 0 30px rgba(255,255,255,.04), 0 0 0 60px rgba(255,255,255,.03); }
.welcome-band h2 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.35rem); font-weight: 850; }
.welcome-band p { max-width: 600px; margin: .35rem 0 0; color: rgba(255,255,255,.76); }
.date-readout { position: relative; z-index: 1; min-width: 210px; padding: .9rem 1rem; text-align: right; color: rgba(255,255,255,.82); background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); border-radius: 8px; }
.date-readout strong { display: block; color: #fff; font-size: 1.25rem; }
.date-readout small { font-size: .75rem; }
.section-kicker { margin: 0 0 .45rem; color: var(--life-blue); font-size: .7rem; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
.content-title { margin: 0; font-size: 1.38rem; font-weight: 800; }
.content-subtitle { margin: .25rem 0 0; color: var(--life-muted); font-size: .88rem; }
.section-header { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 2rem 0 1rem; }

.life-card { color: var(--life-ink); background: var(--life-panel); border: 1px solid var(--life-line); border-radius: 9px; box-shadow: var(--life-shadow); transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.life-card.hoverable:hover { transform: translateY(-3px); border-color: rgba(13,110,253,.35); box-shadow: var(--life-shadow-lg); }
.summary-card { position: relative; overflow: hidden; padding: 1.2rem; }
.summary-card::after { content: ""; position: absolute; width: 84px; height: 84px; right: -30px; bottom: -42px; border: 1px solid rgba(13,110,253,.1); border-radius: 50%; }
.summary-icon { display: grid; width: 42px; height: 42px; place-items: center; color: var(--life-blue); background: #eaf3ff; border-radius: 8px; transition: transform .22s ease; }
[data-theme="dark"] .summary-icon { background: rgba(13,110,253,.18); }
.summary-card:hover .summary-icon { transform: translateY(-3px) rotate(-4deg); }
.summary-card strong { display: block; margin-top: .85rem; font-size: 1.75rem; line-height: 1; }
.summary-card h3 { margin: .35rem 0 .15rem; font-size: .83rem; font-weight: 800; }
.summary-card p { margin: 0; color: var(--life-muted); font-size: .73rem; }
.panel-pad { padding: 1.25rem; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.panel-title h3 { margin: 0; font-size: 1rem; font-weight: 800; }
.panel-title a { color: var(--life-blue); font-size: .78rem; font-weight: 700; }
.muted { color: var(--life-muted); }

.agenda-list, .activity-list { display: grid; gap: .7rem; }
.agenda-item { display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: .75rem; padding: .75rem .8rem; background: var(--life-soft); border-radius: 8px; }
.agenda-time { color: var(--life-blue); font-size: .74rem; font-weight: 800; }
.agenda-item strong { display: block; font-size: .84rem; }
.agenda-item small { color: var(--life-muted); font-size: .73rem; }
.agenda-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--life-teal); box-shadow: 0 0 0 4px rgba(15,159,154,.12); }
.activity-item { position: relative; display: grid; grid-template-columns: 34px 1fr auto; gap: .75rem; align-items: start; }
.activity-item + .activity-item { padding-top: .8rem; border-top: 1px solid var(--life-line); }
.activity-icon { display: grid; width: 32px; height: 32px; place-items: center; color: var(--life-blue); background: #eaf3ff; border-radius: 50%; font-size: .78rem; }
[data-theme="dark"] .activity-icon { background: rgba(13,110,253,.18); }
.activity-item strong { display: block; font-size: .82rem; }
.activity-item span, .activity-item time { color: var(--life-muted); font-size: .71rem; }
.activity-item time { white-space: nowrap; }

.life-table { width: 100%; color: var(--life-ink); vertical-align: middle; }
.life-table thead th { color: var(--life-muted); border-bottom: 1px solid var(--life-line); font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.life-table td { border-bottom: 1px solid var(--life-line); font-size: .82rem; }
.life-table tbody tr:last-child td { border-bottom: 0; }
.life-table tbody tr:hover { background: var(--life-soft); }
.status-pill, .tag-pill { display: inline-flex; align-items: center; padding: .26rem .55rem; color: var(--life-blue); background: #eaf3ff; border-radius: 999px; font-size: .68rem; font-weight: 800; white-space: nowrap; }
.status-pill.success { color: var(--life-green); background: #e9f7ef; }
.status-pill.warning { color: #a36a00; background: #fff5df; }
.status-pill.danger { color: #b3244f; background: #fff0f4; }
[data-theme="dark"] .status-pill, [data-theme="dark"] .tag-pill { background: rgba(13,110,253,.16); }
.progress { height: 7px; background: var(--life-soft); border-radius: 999px; }
.progress-bar { background: linear-gradient(135deg, var(--life-blue), var(--life-teal)); border-radius: 999px; }
.tool-row { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; padding: 1rem; margin-bottom: 1rem; }
.tool-row .form-control, .tool-row .form-select { min-width: 150px; }
.form-control, .form-select, .input-group-text { color: var(--life-ink); background: var(--life-panel); border-color: var(--life-line); }
.form-control::placeholder { color: var(--life-muted); }
.form-control:focus, .form-select:focus { color: var(--life-ink); background: var(--life-panel); border-color: var(--life-blue); box-shadow: 0 0 0 .2rem rgba(13,110,253,.12); }
.btn { border-radius: 7px; font-weight: 750; }
.btn-life { color: #fff; border: 0; background: linear-gradient(135deg, var(--life-blue), var(--life-teal)); box-shadow: 0 10px 22px rgba(13,110,253,.18); }
.btn-life:hover, .btn-life:focus { color: #fff; transform: translateY(-2px); box-shadow: 0 14px 28px rgba(13,110,253,.24); }
.btn-outline-life { color: var(--life-blue); border-color: rgba(13,110,253,.32); }
.btn-outline-life:hover, .btn-outline-life.active { color: #fff; background: var(--life-blue); border-color: var(--life-blue); }
.btn-icon { display: inline-grid; width: 34px; height: 34px; place-items: center; padding: 0; }
.card-actions { display: flex; gap: .35rem; }
.card-actions .btn { opacity: .7; }
.life-card:hover .card-actions .btn { opacity: 1; }

.timeline-wrap { position: relative; padding: .6rem 0 .6rem 2.3rem; }
.timeline-wrap::before { content: ""; position: absolute; top: 0; bottom: 0; left: .55rem; width: 2px; background: var(--life-line); }
.timeline-year { position: relative; margin: 1.2rem 0 .75rem -2.3rem; padding-left: 2.3rem; color: var(--life-blue); font-size: 1.35rem; font-weight: 850; }
.timeline-year::before { content: ""; position: absolute; left: .2rem; top: .45rem; width: 13px; height: 13px; background: var(--life-panel); border: 3px solid var(--life-blue); border-radius: 50%; }
.timeline-event { position: relative; margin-bottom: 1rem; padding: 1rem 1.1rem; }
.timeline-event::before { content: ""; position: absolute; left: -2rem; top: 1.3rem; width: 10px; height: 10px; background: var(--life-teal); border: 2px solid var(--life-panel); border-radius: 50%; box-shadow: 0 0 0 2px var(--life-teal); }
.timeline-event h3 { margin: 0 0 .25rem; font-size: .95rem; }
.timeline-event p { margin: 0; color: var(--life-muted); font-size: .8rem; }
.timeline-event small { color: var(--life-blue); font-size: .7rem; font-weight: 800; }

.journal-card, .memory-card, .note-card, .media-card { height: 100%; overflow: hidden; }
.journal-card-body, .memory-card-body, .note-card-body, .media-card-body { padding: 1.1rem; }
.journal-card h3, .memory-card h3, .note-card h3, .media-card h3 { margin: .45rem 0; font-size: 1rem; }
.journal-card p, .memory-card p, .note-card p, .media-card p { margin: 0; color: var(--life-muted); font-size: .78rem; }
.card-meta { display: flex; flex-wrap: wrap; gap: .55rem; color: var(--life-muted); font-size: .7rem; }
.media-thumb { position: relative; height: 160px; overflow: hidden; background: linear-gradient(135deg, #152d4d, #258d93); }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.life-card:hover .media-thumb img { transform: scale(1.03); }
.media-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 2rem; background: rgba(8,21,37,.2); }
.note-card { border-top: 4px solid var(--life-amber); }
.note-card.pinned { border-top-color: var(--life-rose); }
.note-card.archived { opacity: .7; }
.empty-state { padding: 2.5rem 1rem; color: var(--life-muted); text-align: center; }
.empty-state i { display: block; margin-bottom: .75rem; color: #96a9c1; font-size: 2rem; }

.habit-grid { display: grid; grid-template-columns: minmax(160px, 1.3fr) repeat(7, 1fr); gap: 0; overflow: auto; }
.habit-grid > div { min-width: 42px; padding: .65rem .4rem; border-bottom: 1px solid var(--life-line); font-size: .72rem; text-align: center; }
.habit-grid .habit-name { min-width: 160px; text-align: left; font-weight: 750; }
.habit-cell { display: grid; place-items: center; }
.habit-check { display: grid; width: 24px; height: 24px; place-items: center; color: var(--life-muted); background: var(--life-soft); border: 1px solid var(--life-line); border-radius: 6px; }
.habit-check.done { color: #fff; background: var(--life-teal); border-color: var(--life-teal); }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.calendar-heading { font-size: 1.3rem; font-weight: 850; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--life-line); border-left: 1px solid var(--life-line); }
.calendar-grid > div { min-height: 100px; padding: .55rem; border-right: 1px solid var(--life-line); border-bottom: 1px solid var(--life-line); }
.calendar-day-name { min-height: auto !important; color: var(--life-muted); font-size: .67rem; font-weight: 800; letter-spacing: .08em; text-align: center; text-transform: uppercase; background: var(--life-soft); }
.calendar-day-number { display: flex; align-items: center; justify-content: space-between; color: var(--life-muted); font-size: .75rem; font-weight: 800; }
.calendar-today .calendar-day-number span { display: grid; width: 26px; height: 26px; place-items: center; color: #fff; background: var(--life-blue); border-radius: 50%; }
.calendar-event { display: block; overflow: hidden; margin-top: .4rem; padding: .25rem .4rem; color: var(--life-blue); background: #eaf3ff; border-radius: 4px; font-size: .65rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
[data-theme="dark"] .calendar-event { background: rgba(13,110,253,.18); }
.finance-number { margin: .2rem 0; font-size: 1.65rem; font-weight: 850; }
.finance-number.positive { color: var(--life-green); }
.finance-number.negative { color: var(--life-rose); }
.chart-bar { display: flex; height: 170px; align-items: end; gap: .75rem; padding: 1rem 0 0; border-bottom: 1px solid var(--life-line); }
.chart-bar > div { flex: 1; display: flex; min-width: 28px; height: 100%; flex-direction: column; justify-content: end; align-items: center; gap: .35rem; }
.chart-bar i { display: block; width: 100%; max-width: 34px; background: linear-gradient(180deg, var(--life-teal), var(--life-blue)); border-radius: 5px 5px 0 0; }
.chart-bar span { color: var(--life-muted); font-size: .65rem; }
.search-overlay { position: fixed; inset: 0; z-index: 2000; display: none; padding: 8vh 1rem; background: rgba(8,17,31,.68); backdrop-filter: blur(10px); }
.search-overlay.open { display: block; animation: fadeIn .2s ease; }
.search-box { max-width: 720px; margin: auto; padding: 1.25rem; background: var(--life-panel); border: 1px solid var(--life-line); border-radius: 10px; box-shadow: var(--life-shadow-lg); }
.search-results { max-height: 56vh; overflow-y: auto; margin-top: .75rem; }
.search-result { display: flex; align-items: center; gap: .75rem; padding: .75rem .4rem; border-bottom: 1px solid var(--life-line); }
.search-result:last-child { border-bottom: 0; }
.search-result i { color: var(--life-blue); }
.search-result strong { display: block; font-size: .84rem; }
.search-result small { color: var(--life-muted); }
.toast-container { z-index: 2500; }
.modal-content { color: var(--life-ink); background: var(--life-panel); border-color: var(--life-line); }
.modal-header, .modal-footer { border-color: var(--life-line); }
.modal .btn-close { filter: var(--life-close-filter, none); }
[data-theme="dark"] .modal .btn-close { --life-close-filter: invert(1); }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem; background: linear-gradient(135deg, #0b1727, #103950); }
.auth-shell { display: grid; width: min(1050px, 100%); min-height: 650px; grid-template-columns: .9fr 1.1fr; overflow: hidden; background: var(--life-panel); border-radius: 14px; box-shadow: 0 30px 90px rgba(0,0,0,.24); }
.auth-intro { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 2.2rem; color: #fff; background: linear-gradient(150deg, rgba(12,52,79,.96), rgba(10,122,127,.9)), url("../../images/hero/login-hero.png") center/cover; }
.auth-intro::after { content: ""; position: absolute; right: -90px; bottom: -130px; width: 320px; height: 320px; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; box-shadow: 0 0 0 30px rgba(255,255,255,.04), 0 0 0 60px rgba(255,255,255,.03); }
.auth-brand, .auth-quote { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: .75rem; }
.auth-brand .life-brand-mark { background: rgba(255,255,255,.16); box-shadow: none; }
.auth-quote h1 { max-width: 310px; font-size: clamp(2.1rem, 5vw, 3.7rem); line-height: 1; font-weight: 850; }
.auth-quote p { max-width: 310px; color: rgba(255,255,255,.76); }
.auth-form-wrap { display: flex; align-items: center; padding: 3.5rem; }
.auth-form { width: min(390px, 100%); margin: auto; }
.auth-form h2 { margin-bottom: .4rem; font-size: 1.85rem; font-weight: 850; }
.auth-form .lead { color: var(--life-muted); font-size: .92rem; }
.auth-form .form-label { font-size: .78rem; font-weight: 750; }
.auth-form .form-control { min-height: 50px; }
.auth-form .alert { font-size: .78rem; }
.demo-note { padding: .75rem; color: var(--life-muted); background: var(--life-soft); border-left: 3px solid var(--life-teal); border-radius: 5px; font-size: .75rem; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.animate-in { animation: fadeUp .45s ease both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }

@media (max-width: 991.98px) {
  .life-sidebar { width: 280px; }
  .life-sidebar .offcanvas-header { display: flex; }
  .life-app { margin-left: 0; }
  .life-topbar { padding: .8rem 1rem; }
  .mobile-sidebar-toggle { display: inline-grid; width: 40px; height: 40px; place-items: center; margin-right: .7rem; color: var(--life-ink); background: var(--life-soft); border: 1px solid var(--life-line); border-radius: 7px; }
  .life-content { padding: 1.25rem 1rem 2.5rem; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-intro { min-height: 300px; }
  .auth-form-wrap { padding: 2.5rem 1.5rem; }
}
@media (max-width: 575.98px) {
  .profile-copy { display: none; }
  .topbar-actions { gap: .35rem; }
  .topbar-icon { width: 38px; height: 38px; }
  .section-header { align-items: start; flex-direction: column; }
  .welcome-band { padding: 1.35rem; }
  .date-readout { width: 100%; min-width: 0; text-align: left; }
  .calendar-grid > div { min-height: 70px; padding: .35rem; }
  .calendar-event { font-size: .58rem; }
  .life-table { min-width: 620px; }
  .table-responsive { overflow-x: auto; }
  .auth-page { padding: 0; }
  .auth-shell { min-height: 100vh; border-radius: 0; }
  .auth-intro { min-height: 260px; padding: 1.4rem; }
  .auth-quote h1 { font-size: 2.3rem; }
}
