/* ============================================
   LifeVault — Design System
   Aesthetic: Dark amber journal / refined vault
   ============================================ */

:root {
  --bg:        #0d0d0f;
  --bg2:       #121215;
  --bg3:       #18181c;
  --bg4:       #1e1e24;
  --border:    #2a2a32;
  --border2:   #353540;
  --text:      #e8e6e0;
  --text2:     #a09e99;
  --muted:     #6b6965;
  --amber:     #f59e0b;
  --amber2:    #fbbf24;
  --amber-dim: rgba(245,158,11,0.12);
  --amber-glow:rgba(245,158,11,0.25);
  --red:       #ef4444;
  --green:     #22c55e;
  --blue:      #3b82f6;
  --purple:    #8b5cf6;
  --pink:      #ec4899;
  --sidebar-w: 240px;
  --topbar-h:  56px;
  --radius:    8px;
  --radius2:   12px;
  --radius3:   16px;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-serif:'Instrument Serif', Georgia, serif;
  --shadow:    0 1px 3px rgba(0,0,0,.5), 0 4px 16px rgba(0,0,0,.3);
  --shadow2:   0 8px 32px rgba(0,0,0,.5);
  --transition: .15s ease;
}

[data-theme="light"] {
  --bg:       #f8f7f4;
  --bg2:      #f2f0ec;
  --bg3:      #e8e6e0;
  --bg4:      #dedad2;
  --border:   #d6d2c8;
  --border2:  #c8c4ba;
  --text:     #1a1814;
  --text2:    #4a4740;
  --muted:    #7a7770;
  --amber-dim:rgba(245,158,11,0.08);
  --amber-glow:rgba(245,158,11,0.2);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ====== LAYOUT ====== */
.lv-body { display: flex; min-height: 100vh; }
.auth-body { display: block; min-height: 100vh; background: var(--bg); }

.lv-sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}

.lv-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.lv-topbar {
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky; top: 0;
  z-index: 50;
  gap: 1rem;
}

.lv-content {
  flex: 1;
  padding: 2rem 1.5rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ====== SIDEBAR ====== */
.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none;
  color: var(--text);
}

.logo-icon {
  font-size: 1.4rem;
  color: var(--amber);
  line-height: 1;
}

.logo-text {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.sidebar-close { display: none; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; }

.sidebar-user {
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { font-weight: 500; font-size: 13px; line-height: 1.2; }
.user-role { font-size: 11px; color: var(--muted); text-transform: capitalize; }

.sidebar-nav { padding: 8px 0; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: var(--text2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  position: relative;
  cursor: pointer;
}

.nav-item:hover { background: var(--bg3); color: var(--text); }

.nav-item.active {
  color: var(--amber);
  background: var(--amber-dim);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--amber);
}

.nav-item--danger { color: var(--red); }
.nav-item--danger:hover { background: rgba(239,68,68,.08); }

.nav-icon { font-size: 14px; opacity: .8; width: 16px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--amber);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.nav-divider { height: 1px; background: var(--border); margin: 6px 12px; }

/* ====== TOPBAR ====== */
.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.hamburger {
  display: none;
  flex-direction: column; gap: 4px;
  background: none; border: none;
  cursor: pointer; padding: 4px;
}
.hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--text2); border-radius: 2px;
}

.topbar-search {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.topbar-search input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px 6px 34px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition);
}

.topbar-search input:focus { border-color: var(--amber); }
.topbar-search input::placeholder { color: var(--muted); }

.search-icon {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted); font-size: 13px;
  pointer-events: none;
}

.search-results-dropdown {
  position: absolute;
  top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius2);
  box-shadow: var(--shadow2);
  z-index: 200;
  display: none;
  overflow: hidden;
}

.search-results-dropdown.visible { display: block; }

.search-result-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  transition: background var(--transition);
}

.search-result-item:hover { background: var(--bg4); }
.search-result-type { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.quick-capture-btn {
  background: var(--amber-dim);
  border: 1px solid var(--amber-glow);
  color: var(--amber);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
  font-family: var(--font-body);
}

.quick-capture-btn:hover { background: var(--amber-glow); }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: border-color var(--transition);
}
.theme-toggle:hover { border-color: var(--amber); }

/* ====== FLASH MESSAGES ====== */
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 1.5rem;
  font-size: 13.5px;
  position: relative;
  animation: slideDown .2s ease;
}

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

.flash--success { background: rgba(34,197,94,.1); color: #86efac; border-bottom: 1px solid rgba(34,197,94,.2); }
.flash--error   { background: rgba(239,68,68,.1);  color: #fca5a5; border-bottom: 1px solid rgba(239,68,68,.2); }
.flash button { margin-left: auto; background: none; border: none; cursor: pointer; color: inherit; opacity: .6; }

/* ====== PAGE HEADER ====== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.page-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-subtitle { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ====== CARDS ====== */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  overflow: hidden;
}

.card-body { padding: 1.25rem; }
.card-header {
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

.card-title { font-weight: 600; font-size: 14px; }

/* ====== NOTE CARDS ====== */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.note-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 1rem;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.note-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.note-card.pinned { border-top: 2px solid var(--amber); }

.note-card-color-bar {
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
}

.note-title {
  font-weight: 500;
  font-size: 14.5px;
  margin-bottom: 6px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-preview {
  color: var(--text2);
  font-size: 12.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.note-meta-text { font-size: 11px; color: var(--muted); }

.tag-chip {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg3);
  color: var(--text2);
  border: 1px solid var(--border);
}

.note-actions {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}

.note-card:hover .note-actions { opacity: 1; }

.action-btn {
  width: 26px; height: 26px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 12px;
  color: var(--text2);
  transition: all var(--transition);
  text-decoration: none;
}

.action-btn:hover { background: var(--bg4); color: var(--text); border-color: var(--border2); }
.action-btn.favorited { color: var(--amber); }
.action-btn.pinned    { color: var(--blue); }

/* ====== FORMS ====== */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 6px;
  letter-spacing: .01em;
}

.form-control {
  display: block;
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
}

.form-control:focus { border-color: var(--amber); }
.form-control::placeholder { color: var(--muted); }

textarea.form-control { resize: vertical; min-height: 100px; }

select.form-control { cursor: pointer; }

.form-control--lg { padding: 10px 14px; font-size: 15px; }

.input-password-wrap { position: relative; }
.input-password-wrap .form-control { padding-right: 40px; }
.password-toggle {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  cursor: pointer; font-size: 14px; color: var(--muted);
}

/* ====== BUTTONS ====== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: var(--font-body);
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}

.btn--primary {
  background: var(--amber);
  color: #0d0d0f;
  border-color: var(--amber);
}
.btn--primary:hover { background: var(--amber2); }

.btn--ghost {
  background: transparent;
  color: var(--text2);
  border-color: var(--border);
}
.btn--ghost:hover { background: var(--bg3); color: var(--text); }

.btn--danger {
  background: rgba(239,68,68,.12);
  color: var(--red);
  border-color: rgba(239,68,68,.2);
}
.btn--danger:hover { background: rgba(239,68,68,.2); }

.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--full { width: 100%; justify-content: center; }
.btn--icon { padding: 8px; }

/* ====== BUTTONS TOGGLE GROUP ====== */
.btn-group-toggle { display: flex; gap: 6px; }
.btn-toggle {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text2);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-body);
  transition: all var(--transition);
}
.btn-toggle.active {
  background: var(--amber-dim);
  border-color: var(--amber-glow);
  color: var(--amber);
}

/* ====== DASHBOARD STATS ====== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .875rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: -20px; right: -10px;
  font-size: 4rem;
  opacity: .04;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.stat-card--amber { border-top: 2px solid var(--amber); }
.stat-card--blue  { border-top: 2px solid var(--blue); }
.stat-card--green { border-top: 2px solid var(--green); }
.stat-card--purple{ border-top: 2px solid var(--purple); }

/* ====== DIARY CARDS ====== */
.diary-list { display: flex; flex-direction: column; gap: .75rem; }

.diary-card {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--transition);
}

.diary-card:hover { border-color: var(--border2); }

.diary-date-badge {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 8px 4px;
}

.diary-date-day { font-family: var(--font-serif); font-size: 1.6rem; line-height: 1; color: var(--amber); }
.diary-date-month { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 2px; }

.diary-card-title {
  font-weight: 500;
  font-size: 14.5px;
  margin-bottom: 4px;
  line-height: 1.3;
}
.diary-card-preview {
  font-size: 12.5px;
  color: var(--text2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.diary-card-meta {
  display: flex; gap: 8px; align-items: center;
  font-size: 11.5px; color: var(--muted);
  margin-top: 6px;
}

/* ====== PEOPLE ====== */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.person-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text);
  text-align: center;
  transition: border-color var(--transition), transform var(--transition);
}

.person-card:hover { border-color: var(--border2); transform: translateY(-2px); }

.person-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600;
  color: #fff;
  overflow: hidden;
}

.person-avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-name { font-weight: 500; font-size: 14px; margin-bottom: 4px; }
.person-relationship {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
}

/* ====== RICH TEXT EDITOR ====== */
.ql-toolbar { border-color: var(--border) !important; background: var(--bg3) !important; border-radius: var(--radius) var(--radius) 0 0 !important; }
.ql-container { border-color: var(--border) !important; background: var(--bg2) !important; border-radius: 0 0 var(--radius) var(--radius) !important; font-family: var(--font-body) !important; font-size: 14px !important; min-height: 200px; }
.ql-editor { color: var(--text) !important; }
.ql-editor.ql-blank::before { color: var(--muted) !important; font-style: normal !important; }
.ql-toolbar button, .ql-toolbar span { color: var(--text2) !important; }
.ql-toolbar button:hover, .ql-toolbar button.ql-active { color: var(--amber) !important; }
.ql-stroke { stroke: var(--text2) !important; }
.ql-fill   { fill:   var(--text2) !important; }
.ql-toolbar button:hover .ql-stroke { stroke: var(--amber) !important; }

/* ====== MODAL ====== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  padding: 1rem;
  backdrop-filter: blur(4px);
  animation: fadeIn .15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius3);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow2);
  animation: slideUp .2s ease;
}

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

.modal--sm { max-width: 400px; }
.modal--lg { max-width: 700px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-header button {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 14px;
}

.modal-body { padding: 1.25rem; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: .875rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* ====== AUTH ====== */
.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-brand .logo-icon { font-size: 2.5rem; color: var(--amber); display: block; margin-bottom: .5rem; }
.auth-brand .logo-text { font-family: var(--font-serif); font-size: 1.75rem; color: var(--text); display: block; }
.auth-tagline { color: var(--muted); font-size: 13px; margin-top: 4px; }

.auth-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius3);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
}

.auth-title { font-size: 1.35rem; font-weight: 600; margin-bottom: 4px; }
.auth-subtitle { color: var(--muted); font-size: 13px; margin-bottom: 1.5rem; }

.auth-form .btn--primary { margin-top: .5rem; padding: 10px; font-size: 14px; }

.form-check {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 1rem;
}
.form-check input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--amber); }
.form-check label { margin: 0; font-size: 13px; color: var(--text2); cursor: pointer; }

.auth-link {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 13px;
  color: var(--muted);
}
.auth-link a { color: var(--amber); text-decoration: none; }

/* ====== CALENDAR ====== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 1rem;
}

.calendar-day-header {
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  padding: 6px 0;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
  transition: background var(--transition);
  position: relative;
}

.calendar-day:hover { background: var(--bg3); }
.calendar-day.today { color: var(--amber); font-weight: 600; }
.calendar-day.today::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--amber);
}
.calendar-day.has-entry {
  background: var(--amber-dim);
  color: var(--text);
}
.calendar-day.has-entry:hover { background: var(--amber-glow); }
.calendar-day.other-month { opacity: .3; }

/* ====== VOICE RECORDER ====== */
.voice-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 52px; height: 52px;
  background: var(--amber);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(245,158,11,.4);
  font-size: 20px;
  transition: transform var(--transition), box-shadow var(--transition);
  z-index: 400;
  user-select: none;
}

.voice-fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(245,158,11,.5); }
.voice-fab.recording { background: var(--red); animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 16px rgba(239,68,68,.4); }
  50%       { transform: scale(1.1); box-shadow: 0 6px 24px rgba(239,68,68,.6); }
}

/* ====== MESSAGES ====== */
.message-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: calc(100vh - var(--topbar-h) - 4rem);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  overflow: hidden;
  background: var(--bg2);
}

.message-sidebar {
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.message-sidebar-header {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 14px;
}

.convo-item {
  display: flex; gap: 10px;
  padding: .75rem 1rem;
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
  color: var(--text);
}
.convo-item:hover, .convo-item.active { background: var(--bg3); }
.convo-preview { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-unread { background: var(--amber); color: #000; border-radius: 10px; font-size: 10px; font-weight: 700; padding: 1px 5px; margin-left: auto; flex-shrink: 0; }

.message-main { display: flex; flex-direction: column; }
.message-header { padding: .875rem 1rem; border-bottom: 1px solid var(--border); font-weight: 600; display: flex; align-items: center; gap: 10px; }

.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-bubble-wrap {
  display: flex;
  flex-direction: column;
}
.message-bubble-wrap.sent { align-items: flex-end; }
.message-bubble-wrap.received { align-items: flex-start; }

.message-bubble {
  max-width: 70%;
  padding: 8px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}

.sent .message-bubble {
  background: var(--amber);
  color: #0d0d0f;
  border-bottom-right-radius: 4px;
}

.received .message-bubble {
  background: var(--bg3);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.message-time { font-size: 10.5px; color: var(--muted); margin-top: 2px; padding: 0 4px; }

.message-input-area {
  padding: .875rem 1rem;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px;
}

.message-input-area input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  color: var(--text);
  font-size: 13.5px;
  font-family: var(--font-body);
  outline: none;
}
.message-input-area input:focus { border-color: var(--amber); }

/* ====== PAGINATION ====== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 2rem;
}

.page-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  color: var(--text2);
  text-decoration: none;
  font-size: 13px;
  transition: all var(--transition);
}
.page-btn:hover { border-color: var(--amber); color: var(--amber); }
.page-btn.active { background: var(--amber); border-color: var(--amber); color: #000; font-weight: 600; }
.page-btn.disabled { opacity: .3; pointer-events: none; }

/* ====== TABS ====== */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  gap: 0;
}

.tab-btn {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text2);
  font-size: 13.5px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--transition);
  margin-bottom: -1px;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--amber); border-bottom-color: var(--amber); }

/* ====== SIDEBAR OVERLAY ====== */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 90;
}

/* ====== FILTERS BAR ====== */
.filters-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  font-size: 12.5px;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
}

.filter-chip:hover { border-color: var(--border2); color: var(--text); }
.filter-chip.active { border-color: var(--amber); background: var(--amber-dim); color: var(--amber); }

/* ====== TIMELINE ====== */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 1.25rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px; top: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid var(--bg);
}

.timeline-date { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.timeline-content {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: 13.5px;
}

/* ====== INSTALL WIZARD ====== */
.wizard-container {
  max-width: 540px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.wizard-step {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius3);
  padding: 2rem;
}

.wizard-step-indicator {
  display: flex; gap: 8px; margin-bottom: 2rem;
}

.step-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border2);
  transition: background var(--transition);
}
.step-dot.active   { background: var(--amber); }
.step-dot.completed{ background: var(--green); }

/* ====== SEARCH RESULTS ====== */
.search-results-section { margin-bottom: 2rem; }
.search-results-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: .75rem;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.search-result-row {
  display: flex; gap: 12px;
  padding: .75rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: background var(--transition);
}
.search-result-row:hover { background: var(--bg3); }
.search-result-row-title { font-weight: 500; font-size: 14px; }
.search-result-row-preview { font-size: 12.5px; color: var(--text2); margin-top: 2px; }

/* ====== EMPTY STATE ====== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4rem 2rem;
}

.empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .4; }
.empty-title { font-family: var(--font-serif); font-size: 1.3rem; margin-bottom: .5rem; }
.empty-text  { color: var(--muted); font-size: 13px; margin-bottom: 1.5rem; max-width: 320px; }

/* ====== STREAKS / BADGES ====== */
.streak-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  background: linear-gradient(135deg, var(--amber-dim), transparent);
  border: 1px solid var(--amber-glow);
  border-radius: 20px;
  font-size: 12.5px;
  color: var(--amber);
  font-weight: 500;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
  .lv-sidebar {
    transform: translateX(-100%);
  }
  .lv-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow2);
  }
  .sidebar-overlay.visible { display: block; }
  .sidebar-close { display: flex; }

  .lv-main { margin-left: 0; }
  .hamburger { display: flex; }
  .quick-capture-btn span { display: none; }

  .lv-content { padding: 1.25rem 1rem; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .notes-grid { grid-template-columns: 1fr; }
  .people-grid { grid-template-columns: repeat(2, 1fr); }

  .message-layout { grid-template-columns: 1fr; }
  .message-sidebar { display: none; }
  .message-sidebar.show { display: block; }

  .page-title { font-size: 1.4rem; }
  .calendar-grid { gap: 2px; }
  .calendar-day { font-size: 11px; }
}

@media (max-width: 480px) {
  .people-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid  { grid-template-columns: 1fr 1fr; }
  .auth-card   { padding: 1.5rem; }
}

/* ====== UTILITIES ====== */
.privacy-sensitive {
  position: relative;
  transition: filter var(--transition), opacity var(--transition);
}

.privacy-sensitive-manual {
  position: relative;
  transition: filter var(--transition), opacity var(--transition);
}

.privacy-mask .privacy-sensitive,
.privacy-mask .privacy-sensitive-manual {
  filter: blur(1.7px);
}

.privacy-mask .privacy-sensitive::after,
.privacy-mask .privacy-sensitive-manual::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 6px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(13,13,15,.14), rgba(13,13,15,.24));
}

.privacy-sensitive.privacy-reveal,
.privacy-sensitive-manual.privacy-reveal,
.privacy-sensitive.privacy-reveal::after {
  filter: none !important;
  background: transparent !important;
}

.privacy-sensitive-manual.privacy-reveal::after {
  background: transparent !important;
}

.text-amber  { color: var(--amber); }
.text-muted  { color: var(--muted); }
.text-danger { color: var(--red); }
.text-success{ color: var(--green); }
.text-sm     { font-size: 12.5px; }
.text-xs     { font-size: 11px; }
.text-serif  { font-family: var(--font-serif); }
.font-medium { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.d-flex      { display: flex; }
.align-center{ align-items: center; }
.gap-1       { gap: .25rem; }
.gap-2       { gap: .5rem; }
.gap-3       { gap: .75rem; }
.gap-4       { gap: 1rem; }
.mb-1        { margin-bottom: .25rem; }
.mb-2        { margin-bottom: .5rem; }
.mb-3        { margin-bottom: .75rem; }
.mb-4        { margin-bottom: 1rem; }
.mb-6        { margin-bottom: 1.5rem; }
.mt-auto     { margin-top: auto; }
.ml-auto     { margin-left: auto; }
.flex-1      { flex: 1; }
.justify-between { justify-content: space-between; }
.wrap        { flex-wrap: wrap; }
.truncate    { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden      { display: none !important; }
.sr-only     { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
