/* ── Dark theme (default) — Rekindlr rose palette ── */
:root,
[data-theme="dark"] {
  --bg-r: 26;
  --bg-g: 15;
  --bg-b: 20;
  --card: #2a1a22;
  --card-hover: #321f29;
  --border: #3d2a33;
  --text: #fdf2f5;
  --text-muted: #9d9d9d !important;
  --indigo: #d21de1;
  --indigo-dark: #be185d;
  --indigo-light: #f472b6;
  --amber: #f59e0b;
  --gradient: linear-gradient(135deg,#be185d 0%,#ae0349 50%,#9d0041 100%);
  --radius: 16px;
  --radius-sm: 10px;
  --font-scale: 1;
  --muted-r: 167;
  --muted-g: 139;
  --muted-b: 148;
}

/* ── Light theme — light version of the rose palette ── */
[data-theme="light"] {
  --bg-r: 252;
  --bg-g: 248;
  --bg-b: 250;
  --card: #fff;
  --card-hover: #fdf2f5;
  --border: #e5d5db;
  --text: #2c2c2c;
  --text-muted: rgba(100, 80, 90, 0.6) !important;
  /* Chart colours match dark theme for consistent visualization */
  --indigo: #e11d6b;
  --indigo-dark: #be185d;
  --indigo-light: #f472b6;
  --amber: #f59e0b;
  --gradient: linear-gradient(135deg,#e11d6b 0%,#f472b6 50%,#f9a8d4 100%);
  --muted-r: 167;
  --muted-g: 139;
  --muted-b: 148;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  background: rgb(var(--bg-r), var(--bg-g), var(--bg-b));
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  padding-bottom: 0;
  overflow-x: hidden;
}

/* ── Auth ── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; padding: 40px 20px; }
.auth-box { width: 100%; max-width: 400px; margin: 0 auto; }
.auth-box .logo { font-size: calc(28px * var(--font-scale)); font-weight: 700; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; text-align: center; margin-bottom: 4px; }
.auth-box .tagline { text-align: center; color: var(--text-muted); font-size: calc(14px * var(--font-scale)); margin-bottom: 28px; }
.auth-tabs { display: flex; background: var(--card); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 24px; }
.auth-tabs button { flex: 1; padding: 10px; border: none; background: transparent; color: var(--text-muted); font-size: calc(14px * var(--font-scale)); font-weight: 600; border-radius: 8px; cursor: pointer; transition: .2s; }
.auth-tabs button.active { background: var(--indigo); color: #fff; }

/* ── Page container ── */
.page { padding: 16px 16px 20px; max-width: 720px; margin: 0 auto; font-size: calc(14px * var(--font-scale)); }
.page h1 { font-size: calc(22px * var(--font-scale)); font-weight: 700; margin-bottom: 4px; }
.page .subtitle { color: var(--text-muted); font-size: calc(13px * var(--font-scale)); margin-bottom: 20px; }
.narrative-text { font-size: calc(14px * var(--font-scale)); line-height: 1.7; }
.correlation-item { font-size: calc(14px * var(--font-scale)); line-height: 1.5; padding: 4px 0; }
.generate-prompt { font-size: calc(13px * var(--font-scale)); color: var(--text-muted); }
.loading-xs { font-size: calc(12px * var(--font-scale)); }



/* ── Cards ── */
.card-e { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem; transition: .2s; }
.card-e.hover:hover { background: var(--card-hover); cursor: pointer; }
.card-e.card-e-open { border-color: var(--indigo); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }

/* ── Form ── */
.form-e { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; width: 100%; color: var(--text); font-size: calc(15px * var(--font-scale)); outline: none; transition: .2s; }
.form-e:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(225,29,107,.15); }
.form-e::placeholder { color: var(--text-muted); opacity: .5; }
textarea.form-e { resize: vertical; min-height: 180px; line-height: 1.7; }

/* ── Buttons ── */
.btn-e {
  border: none; padding: 10px 24px; border-radius: var(--radius-sm);
  font-size: calc(14px * var(--font-scale)); font-weight: 600; cursor: pointer; transition: .2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-e.primary { background: var(--gradient); color: #fff; }
.btn-e.primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(225,29,107,.35); }
.btn-e.primary:disabled { opacity: .5; transform: none; box-shadow: none; }
.btn-e.outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-e.outline:hover { border-color: var(--indigo); color: var(--indigo-light); }
.btn-e.outline.active { border-color: var(--indigo); color: var(--indigo-light); }
.btn-e.danger { background: #dc2626; color: #fff; }
.btn-e.sm { padding: 6px 14px; font-size: calc(12px * var(--font-scale)); }

/* ── Mood picker ── */
.mood-row { display: flex; justify-content: center; gap: 1px; flex-wrap: wrap; }
.mood-btn {
  width: 64px; padding: 8px 0 6px; border-radius: 12px; border: 2px solid var(--border);
  background: var(--card); cursor: pointer; transition: .2s;
  display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 2px;
}
.mood-btn .emoji { font-size: calc(30px * var(--font-scale)); line-height: 1; padding: 2px; }
.mood-btn .label { font-size: calc(10px * var(--font-scale)); color: var(--text-muted); font-weight: 500; line-height: 1.2; }
.mood-btn:hover { border-color: var(--indigo); transform: translateY(-2px); }
.mood-btn.selected { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(225,29,107,.2); background: rgba(225,29,107,.1); }

/* ── Entry list ── */
.entry-item { margin-bottom: 10px; }
.entry-item .meta { display: flex; align-items: center; gap: 8px; font-size: calc(11px * var(--font-scale)); color: var(--text-muted); margin-bottom: 4px; }
.entry-item .preview { font-size: calc(14px * var(--font-scale)); color: var(--text-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.entry-item .preview-full { font-size: calc(14px * var(--font-scale)); color: var(--text-muted); line-height: 1.5; }
.card-e-open .preview { -webkit-line-clamp: unset; display: block; overflow: visible; }
.entry-item .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.entry-highlight .card-e { border-color: var(--indigo); box-shadow: inset 3px 0 0 var(--indigo), 0 0 12px rgba(225,29,107,.15); }
.entry-new .card-e { border-color: var(--indigo-light); box-shadow: 0 0 0 2px rgba(225,29,107,.15), 0 0 20px rgba(225,29,107,.25); animation: fade-glow 2.5s ease-out forwards; }
@keyframes fade-glow { 0% { box-shadow: 0 0 0 3px rgba(225,29,107,.35), 0 0 24px rgba(225,29,107,.3); } 100% { box-shadow: 0 0 0 2px rgba(225,29,107,.15), 0 0 20px rgba(225,29,107,.25); } }
.tag-e { display: inline-block; padding: 2px 8px; border-radius: 8px; border: 1px solid #888; font-size: calc(12px * var(--font-scale)); font-weight: 500; background: rgba(225,29,107,.75); color: #FFF; }
.tag-e.pending { background: rgba(245,158,11,.12); color: #f59e0b; }
.tag-e.failed { background: rgba(239,68,68,.12); color: #ef4444; }

/* ── Analysis display ── */
.analysis-box { background: rgba(225,29,107,.06); border: 1px solid rgba(225,29,107,.15); padding: 16px; }
.analysis-box .label { font-size: calc(11px * var(--font-scale)); font-weight: 600; color: var(--indigo-light); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.analysis-box .mood-score { font-size: calc(32px * var(--font-scale)); font-weight: 700; }
.analysis-box .score-row { display: flex; justify-content: center; gap: 24px; margin-bottom: 12px; }
.analysis-box .score-item { text-align: center; }
.analysis-box .score-item small { display: block; font-size: calc(10px * var(--font-scale)); color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.entry-analysis-expanded { border: 1px solid var(--indigo);border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px;margin-bottom: 10px;overflow: hidden; }
.entry-actions { display: flex; gap: 8px; padding: 10px 12px; background: var(--card); border-bottom: 0; }
.entry-actions .btn-e { margin: 0; }
.journal-actions { display: flex; gap: 8px; }

/* ── Calendar (land4 heatmap style) ── */
@media (max-width: 576px) {
  .cal-scroll { max-height: 72vh; overflow-y: auto; }
}
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-header h3 { font-size: calc(13px * var(--font-scale)); font-weight: 700; margin: 0; letter-spacing: .3px; text-transform: uppercase; color: var(--text-muted); }
.cal-header h3 i { margin-right: 4px; }
.cal-header .nav { display: flex; gap: 4px; }
.cal-header .nav button { width: 28px; height: 28px; border-radius: 4px; border: 1px solid var(--border); background: var(--card); color: var(--text-muted); cursor: pointer; font-size: calc(12px * var(--font-scale)); transition: .15s; display:flex;align-items:center;justify-content:center; }
.cal-header .nav button:hover { border-color: var(--indigo); color: var(--indigo-light); }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; }
.cal-grid .day-h { text-align: center; font-size: calc(9px * var(--font-scale)); color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; padding: 2px 0 4px; font-weight: 600; }
.cal-grid .day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 3px; font-size: calc(10px * var(--font-scale)); cursor: pointer; transition: .15s;
  color: var(--text); border: 1px solid transparent;
}
.cal-grid .day:hover { border-color: rgba(148,163,184,.3); }
.cal-grid .day.other { color: var(--text-muted); opacity: .3; }
.cal-grid .day.today { font-weight: 700; border-color: var(--indigo); color: var(--indigo-light); }
/* Heatmap intensity levels */
.cal-grid .day.lvl1 { background: rgba(225,29,107,.15); color: var(--text); }
.cal-grid .day.lvl2 { background: rgba(225,29,107,.32); color: var(--text); }
.cal-grid .day.lvl3 { background: rgba(225,29,107,.55); color: #fff; }
.cal-grid .day.lvl4 { background: var(--indigo); color: #0f172a; font-weight: 700; }
/* Legend */
.cal-legend { display: flex; gap: 14px; font-size: calc(10px * var(--font-scale)); color: var(--text-muted); margin-top: 10px; justify-content: center; }
.cal-legend .cl { display: flex; align-items: center; gap: 4px; }
.cal-legend .cl .sq { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.cal-legend .cl .sq.lvl1 { background: rgba(225,29,107,.15); }
.cal-legend .cl .sq.lvl2 { background: rgba(225,29,107,.32); }
.cal-legend .cl .sq.lvl3 { background: rgba(225,29,107,.55); }
.cal-legend .cl .sq.lvl4 { background: var(--indigo); }
.cal-day-entries { margin-top: 16px; }
.cal-day-entries h4 { font-size: calc(13px * var(--font-scale)); color: var(--text-muted); margin-bottom: 8px; letter-spacing: .3px; }
/* Remove old mood dot styles no longer used */

/* ── Search layout: calendar + entries side by side on desktop ── */
@media (min-width: 768px) {
  .search-layout { display: flex; gap: 24px; align-items: flex-start; }
  .search-cal { flex-shrink: 0; width: 340px; }
  .search-entries { flex: 1; min-width: 0; }
}
@media (max-width: 767px) {
  .search-cal { width: 100%; }
  .search-entries { width: 100%; }
}

/* ── Mood vs Energy dual chart ── */
.dual-chart { padding: 4px 0; }
.dc-row { display: flex; align-items: flex-end; gap: 6px; height: 90px; }
.dc-group { flex: 1; display: flex; gap: 2px; align-items: flex-end; justify-content: center; height: 100%; }
.dc-bar {
  width: 40%; border-radius: 3px 3px 0 0;
  position: relative; transition: height .3s;
  display: flex; align-items: flex-start; justify-content: center;
}
.dc-bar.mood { background: var(--indigo); }
.dc-bar.energy { background: var(--amber); }
.dc-bar .dc-val {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  font-size: calc(8px * var(--font-scale)); font-weight: 700; white-space: nowrap; margin-bottom: 1px;
  color: var(--text);
}
.dc-labels { display: flex; gap: 6px; margin-top: 4px; }
.dc-labels span { flex: 1; text-align: center; font-size: calc(8px * var(--font-scale)); color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; }
.dc-legend { display: flex; gap: 14px; justify-content: center; margin-top: 6px; font-size: calc(10px * var(--font-scale)); color: var(--text-muted); }
.dcl { display: flex; align-items: center; gap: 4px; }
.dcl-sq { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.dcl-sq.mood { background: var(--indigo); }
.dcl-sq.energy { background: var(--amber); }

/* ── Analysis donuts ── */
.wd-donut { width: 84px; height: 84px; transform: rotate(-90deg); display: block; margin: 0 auto; }
.wd-track { fill: none; stroke: rgba(148,163,184,.1); stroke-width: 3; }
.wd-fill { fill: none; stroke: var(--indigo); stroke-width: 3; stroke-linecap: round; transition: stroke-dasharray .6s; }
.wd-fill.energy { stroke: var(--amber); }
.wd-text { fill: var(--text); font-size: calc(10px * var(--font-scale)); font-weight: 700; text-anchor: middle; transform: rotate(90deg); transform-origin: 18px 18px; }
.analysis-donut { width: 48px; height: 48px; transform: rotate(-90deg); display: block; margin: 0 auto; }
.ad-track { fill: none; stroke: rgba(148,163,184,.1); stroke-width: 3; }
.ad-fill { fill: none; stroke: var(--indigo); stroke-width: 3; stroke-linecap: round; transition: stroke-dasharray .6s; }
.ad-fill.energy { stroke: var(--amber); }
.ad-text { fill: var(--text); font-size: calc(10px * var(--font-scale)); font-weight: 700; text-anchor: middle; transform: rotate(90deg); transform-origin: 24px 24px; }

/* ── Week digests ── */
.period-toggle { display: flex; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; margin-bottom: 14px; }
.period-toggle button { flex: 1; padding: 8px; border: none; background: transparent; color: var(--text-muted); font-size: calc(13px * var(--font-scale)); font-weight: 600; border-radius: 8px; cursor: pointer; transition: .2s; }
.period-toggle button.active { background: var(--indigo); color: #fff; }
.week-card { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.week-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; cursor: pointer; transition: .2s; font-size: calc(14px * var(--font-scale)); font-weight: 600; background: var(--card); }
.week-header:hover { background: var(--card-hover); }
.week-header.disabled { cursor: default; opacity: .45; }
.week-header.disabled:hover { background: var(--card); }
.week-header .chevron { color: var(--text-muted); font-size: calc(14px * var(--font-scale)); transition: transform .2s; }
.week-header .chevron.open { transform: rotate(180deg); }
.week-body { padding: 0 16px 14px; background: var(--card); }
.week-body .narrative { font-size: calc(14px * var(--font-scale)); line-height: 1.6; }

/* Week digest score row */
.week-score-row { display: flex; justify-content: center; gap: 32px; padding: 16px 0 8px; }
.week-score-item { text-align: center; }
.week-score-emoji { font-size: calc(28px * var(--font-scale)); display: block; line-height: 1.2; }
.week-score-val { font-size: calc(22px * var(--font-scale)); font-weight: 700; display: block; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.week-score-item small { font-size: calc(10px * var(--font-scale)); color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; display: block; margin-top: 2px; }

/* Mini trend bar */
.week-trend { padding: 8px 0 4px; }
.week-trend-bar { display: flex; align-items: flex-end; gap: 3px; height: 100px; }
.week-trend-bar .wt-bar { flex: 1; border-radius: 3px 3px 0 0; min-height: 3px; background: var(--gradient); position: relative; transition: height .3s; }
.week-trend-bar .wt-bar .wt-val { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: calc(8px * var(--font-scale)); color: var(--text-muted); margin-bottom: 1px; white-space: nowrap; }
.week-trend-labels { display: flex; gap: 3px; margin-top: 2px; }
.week-trend-labels span { flex: 1; text-align: center; font-size: calc(8px * var(--font-scale)); color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; }

/* Week narrative */
.week-narrative { font-size: calc(14px * var(--font-scale)); line-height: 1.7; padding: 8px 0; color: var(--text); }

/* Week sections (themes, correlations) */
.week-section { padding: 10px 0 4px; border-top: 1px solid var(--border); margin-top: 4px; }
.week-section-title { font-size: calc(11px * var(--font-scale)); font-weight: 600; color: var(--indigo-light); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.week-section-title i { margin-right: 4px; }
.week-body .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.week-correlation { font-size: calc(14px * var(--font-scale)); color: var(--text); line-height: 1.5; padding: 3px 0; }
.week-correlation .corr-icon { color: var(--indigo-light); margin-right: 4px; }

/* ── Settings ── */
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.setting-row + .setting-row { border-top: 1px solid var(--border); }
.setting-row .sl { font-size: calc(14px * var(--font-scale)); font-weight: 500; }
.setting-row .sd { font-size: calc(12px * var(--font-scale)); color: var(--text-muted); }
.tier-badge { padding: 2px 10px; border-radius: 8px; font-size: calc(11px * var(--font-scale)); font-weight: 600; }
.tier-badge.free { background: rgba(245,158,11,.12); color: #f59e0b; }
.tier-badge.core { background: rgba(225,29,107,.12); color: var(--indigo-light); }
.tier-badge.deep { background: rgba(168,85,247,.12); color: #a855f7; }

/* ── Step indicator ── */
.step-indicator { display: flex; align-items: center; justify-content: center; gap: 0; margin-bottom: 20px; }
.step-dot {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: calc(12px * var(--font-scale)); font-weight: 700; background: var(--card); border: 2px solid var(--border); color: var(--text-muted);
  transition: .2s; flex-shrink: 0;
}
.step-dot.active { border-color: var(--indigo); color: var(--indigo); }
.step-dot.done { background: var(--indigo); border-color: var(--indigo); color: #0f172a; }
.step-line {
  width: 40px; height: 2px; background: var(--border); transition: .2s; flex-shrink: 0;
}
.step-line.active { background: var(--indigo); }
.step-label { display: block; color: var(--text-muted); font-size: calc(11px * var(--font-scale)); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }

/* ── Toast ── */
.toast-e {
  position: fixed; top: 12px; left: 12px; right: 12px; z-index: 999;
  border-radius: var(--radius-sm);
  padding: 14px 18px; font-size: calc(14px * var(--font-scale));
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  transition: opacity .3s, transform .3s;
  opacity: 0; pointer-events: none; text-align: center;
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.toast-e.show { opacity: 1; }
.toast-e.success {
  background: rgba(34,197,94,.18);
  border-color: rgba(34,197,94,.5);
  color: #86efac;
}
.toast-e.error {
  background: rgba(239,68,68,.18);
  border-color: rgba(239,68,68,.5);
  color: #fca5a5;
}

/* ── Loading ── */
.spin-e { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--indigo-light); border-radius: 50%; animation: spin .6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .6; transform: scale(1.1); } }
.pulse-mic { display: inline-block; animation: pulse 1.2s ease-in-out infinite; }
.loading-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; gap: 12px; color: var(--text-muted); font-size: calc(14px * var(--font-scale)); }

/* ── Theme tag cloud ── */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cloud-tag { display: inline-block; padding: 3px 10px; border-radius: 20px; background: rgba(225,29,107,.12); color: var(--indigo-light); line-height: 1.4; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state i { font-size: calc(40px * var(--font-scale)); color: var(--text-muted); opacity: .3; margin-bottom: 12px; }
.empty-state p { color: var(--text-muted); font-size: calc(14px * var(--font-scale)); }

/* ── Stat row (dashboard) ── */
.stat-row { display: flex; gap: 10px; margin-bottom: 16px; margin-top: 16px; }
.stat-item {
  flex: 1; background: var(--card);
  border-radius: 14px; padding: 12px 10px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.stat-icon { font-size: 2rem; margin-bottom: 6px; line-height: 1; }
.stat-val { font-weight: 700; font-size: calc(20px * var(--font-scale)); line-height: 1.2; margin-bottom: 2px; text-align: center; width: 100%; }
.stat-label { font-size: calc(9px * var(--font-scale)); color: var(--text-muted); line-height: 1.3; text-transform: uppercase; letter-spacing: .3px; text-align: center; width: 100%; }

/* Modal overlay */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.9);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 0;
  overflow-y: auto;
}
.modal-content {
  background: var(--card);
  width: 100%; max-width: 500px; min-height: auto;
  padding: 16px; margin: 0;
  border: none; border-radius: var(--radius);
}
@media (max-width: 576px) {
  .modal-content { padding: 5px; }
}


/* ── Home menu dropdown ── */
@keyframes fadeIn { from { opacity:0; transform:translateY(-4px) } to { opacity:1; transform:translateY(0) } }
@keyframes slideMenu { from { opacity:0; transform:translateX(16px) } to { opacity:1; transform:translateX(0) } }

/* ── Offcanvas ── */
.offcanvas-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(0,0,0,.6);
  display: flex; justify-content: flex-end;
}
.offcanvas-panel {
  width: 280px; max-width: 80vw; height: 100%;
  background: var(--card);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  animation: slideInRight .2s ease-out;
}
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.offcanvas-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid var(--border);
}
.offcanvas-body { flex: 1; padding: 8px; overflow-y: auto; }
.offcanvas-item {
  display: flex; align-items: center; padding: 12px 14px;
  border-radius: 8px; cursor: pointer; font-size: calc(14px * var(--font-scale)); font-weight: 500;
  color: var(--text); transition: .15s;
}
.offcanvas-item:hover { background: var(--card-hover); }

/* ── Floating notification status ── */
.fab-notif {
  position: fixed;
  bottom: 24px;
  left: 20px;
  z-index: 999;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid #ef4444;
  background: rgba(239,68,68,.12);
  color: #ef4444;
  font-size: calc(16px * var(--font-scale));
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: .2s;
}
.fab-notif:hover { background: rgba(239,68,68,.2); box-shadow: 0 0 12px rgba(239,68,68,.3); }
.fab-notif.on {
  border: 1px solid rgba(34,197,94,.5);
  background: transparent;
  color: rgba(34,197,94,.7);
  font-weight: 400;
}
.fab-notif.on:hover { background: rgba(34,197,94,.06); box-shadow: 0 0 8px rgba(34,197,94,.15); }

/* ── Floating action button (Write) ── */
.fab-write {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--gradient);
  color: #fff;
  font-size: calc(24px * var(--font-scale));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: rekindlr-pulse 2.5s ease-in-out infinite;
}
.fab-write:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}
.fab-write:active {
  transform: scale(0.95);
}

@keyframes rekindlr-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.3); }
  50% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
}

/* ── Home logo button with FAB-style pulse ── */
.home-logo {
  animation: home-pulse 2.5s ease-in-out infinite;
}
@keyframes home-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225, 29, 107, 0.35); }
  50% { box-shadow: 0 0 0 10px rgba(225, 29, 107, 0); }
}

/* ── Entity frequency grid (donuts) ── */
.entity-freq-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 6px; }
@media (max-width: 576px) { .entity-freq-grid { grid-template-columns: repeat(2, 1fr); } }
.entity-freq-donut { text-align: center; background: rgba(225,29,107,.06); border-radius: 10px; padding: 8px 6px; }
.ef-donut-name { font-size: calc(10px * var(--font-scale)); color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ef-donut-freq { font-size: calc(11px * var(--font-scale)); color: var(--text); font-weight: 600; }

/* ── What's happening (merged themes + frequency grid) ── */
.wh-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 576px) { .wh-grid { grid-template-columns: repeat(2, 1fr); } }
.wh-card {
  background: rgba(225, 29, 107, .06);
  border-radius: 10px; padding: 10px 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.wh-name { font-size: calc(11px * var(--font-scale)); font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.wh-count { font-size: calc(18px * var(--font-scale)); font-weight: 700; color: var(--rose-light); line-height: 1; }
.wh-sentiment { display: flex; gap: 2px; width: 100%; height: 4px; border-radius: 2px; overflow: hidden; }
.wh-bar { height: 100%; min-width: 2px; transition: width .3s; }

/* Direction badges (used by dashboard + digests) */
.dir-badge { font-size: calc(10px * var(--font-scale)); padding: 1px 6px; border-radius: 4px; text-transform: capitalize; }
.dir-up { background: rgba(34,197,94,.15); color: #22c55e; }
.dir-down { background: rgba(239,68,68,.15); color: #ef4444; }
.dir-new { background: rgba(225,29,107,.15); color: var(--indigo-light); }
.dir-flat { background: rgba(148,163,184,.15); color: var(--text-muted); }

/* ── Month-over-month ── */
.mom-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mom-item {
  background: rgba(225,29,107,.06);
  border-radius: 10px; padding: 8px 12px;
  flex: 1; min-width: 100px;
  display: flex; flex-direction: column; gap: 2px;
}
.mom-label { font-size: calc(10px * var(--font-scale)); text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
.mom-val { font-size: calc(14px * var(--font-scale)); font-weight: 600; }

/* ── Cumulative profile ── */
.profile-stats-row { display: flex; gap: 8px; margin-top: 12px; }
.profile-stat {
  background: var(--card); border-radius: 10px; padding: 10px;
  flex: 1; text-align: center;
}
.profile-stat-val { display: block; font-size: calc(20px * var(--font-scale)); font-weight: 700; }
.profile-stat-label { display: block; font-size: calc(9px * var(--font-scale)); color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; margin-top: 2px; }
.profile-section { margin-top: 12px; }
.profile-section-title { font-size: calc(12px * var(--font-scale)); font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
.profile-pattern-item {
  display: flex; align-items: flex-start; gap: 6px;
  padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.05);
}
.profile-pattern-text { font-size: calc(13px * var(--font-scale)); line-height: 1.4; }
.conf-badge {
  font-size: calc(9px * var(--font-scale)); padding: 1px 5px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: .3px;
  white-space: nowrap; flex-shrink: 0; margin-top: 2px;
}
.conf-badge.high { background: rgba(34,197,94,.15); color: #22c55e; }
.conf-badge.medium { background: rgba(251,191,36,.15); color: #f59e0b; }
.conf-badge.low { background: rgba(148,163,184,.15); color: var(--text-muted); }
.profile-alert-item {
  display: flex; align-items: flex-start;
  padding: 6px 0; font-size: calc(13px * var(--font-scale)); line-height: 1.4;
}

/* ── Light theme overrides ── */
[data-theme="light"] .modal-overlay {
  background: rgba(0,0,0,.45);
}
[data-theme="light"] .profile-pattern-item {
  border-bottom: 1px solid rgba(0,0,0,.06);
}
[data-theme="light"] .tag-e {
  background: rgba(14,116,144,.7);
}
[data-theme="light"] .analysis-box {
  background: rgba(14,116,144,.06);
  border-color: rgba(14,116,144,.15);
}
[data-theme="light"] .cloud-tag {
  background: rgba(14,116,144,.1);
  color: var(--indigo-dark);
}
[data-theme="light"] .cal-grid .day.lvl1 { background: rgba(14,116,144,.12); }
[data-theme="light"] .cal-grid .day.lvl2 { background: rgba(14,116,144,.28); }
[data-theme="light"] .cal-grid .day.lvl3 { background: rgba(14,116,144,.5); }
[data-theme="light"] .cal-grid .day.lvl4 { background: var(--indigo); color: #fff; }
[data-theme="light"] .cal-legend .cl .sq.lvl1 { background: rgba(14,116,144,.12); }
[data-theme="light"] .cal-legend .cl .sq.lvl2 { background: rgba(14,116,144,.28); }
[data-theme="light"] .cal-legend .cl .sq.lvl3 { background: rgba(14,116,144,.5); }
[data-theme="light"] .cal-grid .day:hover { border-color: rgba(0,0,0,.15); }
[data-theme="light"] .entry-highlight .card-e {
  box-shadow: inset 3px 0 0 var(--indigo), 0 0 12px rgba(14,116,144,.12);
}
[data-theme="light"] .entry-new .card-e {
  box-shadow: 0 0 0 2px rgba(14,116,144,.12), 0 0 20px rgba(14,116,144,.2);
}
@keyframes fade-glow-light {
  0% { box-shadow: 0 0 0 3px rgba(14,116,144,.3), 0 0 24px rgba(14,116,144,.25); }
  100% { box-shadow: 0 0 0 2px rgba(14,116,144,.12), 0 0 20px rgba(14,116,144,.2); }
}
[data-theme="light"] .entry-new .card-e {
  animation: fade-glow-light 2.5s ease-out forwards;
}
[data-theme="light"] .dir-up,
[data-theme="light"] .dir-new {
  color: #212529 !important;
}

/* ── Offcanvas section header ── */
.ofs-section {
  padding: 8px 14px;
  font-size: calc(11px * var(--font-scale));
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
  margin: 0 -8px 8px;
}/* ── Bigsys Journal — Custom Style Overrides ── */
/* Only styles actually referenced in app.php, extracted from repeated inline styles */

/* Card section titles */
.card-title { font-size: calc(.9rem * var(--font-scale)); font-weight: 600; margin-bottom: 8px; }
.card-title-sm { font-size: calc(13px * var(--font-scale)); font-weight: 600; margin-bottom: 6px; }

/* Help info icons */
.card-title, .card-title-sm, .week-section-title { position: relative; }
.help-icon { position: absolute; right: 0; top: 0; cursor: pointer; font-size: calc(14px * var(--font-scale)); color: var(--text-muted); }
.help-icon-sm { position: absolute; right: 0; top: 0; cursor: pointer; font-size: calc(12px * var(--font-scale)); color: var(--text-muted); }

/* Danger + flex utilities */
.flex-1 { flex: 1; }

/* Search entries */
.entry-item .card-body .preview {
	font-size: calc(.9rem * var(--font-scale));
	color: var(--text) !important;
}
.entry-item .card-header {
	font-size: calc(.85rem * var(--font-scale));
	color: var(--text) !important;
	font-weight: 600;
}

/* Patterns this week */
.narrative-text { font-size: calc(.9rem * var(--font-scale)); line-height: 1.6; margin-bottom: 10px; color: var(--text); }
.correlation-item { font-size: calc(.9rem * var(--font-scale)); padding: 2px 0; margin-bottom: 10px; margin-top: 10px; color: var(--text); }
.correlation-arrow { color: var(--indigo-light); margin-right: 4px; }
.generate-prompt { font-size: calc(12px * var(--font-scale)); color: var(--text-muted); margin-bottom: 8px; }

/* Analysis entry cards */
.analysis-header { margin-top: 0; border-radius: 0; text-align: center; border-top: 0; }
.analysis-body { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
.analysis-label { font-size: calc(13px * var(--font-scale)); font-weight: 600; color: var(--indigo-light); }
.summary-text { font-size: calc(13px * var(--font-scale)); line-height: 1.6; margin-bottom: 8px; }
.no-data-text { font-size: calc(13px * var(--font-scale)); text-align: center; padding: 12px; }

/* Loading text */
.loading-xs { font-size: calc(11px * var(--font-scale)); color: var(--text-muted); }

/* Entry mood emoji */
.entry-mood { font-size: calc(1rem * var(--font-scale)); }

/* Card header */
.card-header { font-size: calc(13px * var(--font-scale)); font-weight: 600; padding: 0 0 5px 0; background: none; border: none; border-bottom: 1px solid var(--border); margin-bottom: 5px; display: flex; justify-content: space-between; align-items: center; }
.card-header .help-icon,
.card-header .help-icon-sm { position: static; }
.card-body { padding: 0; }

/* Entry dropdown menu */
.menu-dropdown { position: absolute; right: 0; top: 100%; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 4px; z-index: 50; min-width: 120px; box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.menu-item { padding: 6px 10px; cursor: pointer; font-size: calc(13px * var(--font-scale)); border-radius: 4px; display: flex; align-items: center; gap: 6px; }
.menu-item:hover { background: var(--card-hover); }
.menu-item.danger:hover { background: rgba(239,68,68,.1); }

/* ── Push notification toggle ── */
.notif-toggle { display:inline-block; width:40px; height:22px; border-radius:11px; background:var(--border); position:relative; cursor:pointer; transition:background .2s; flex-shrink:0; }
.notif-toggle.on { background:var(--indigo-light); }
.notif-knob { position:absolute; top:2px; left:2px; width:18px; height:18px; border-radius:50%; background:#fff; transition:transform .2s; }
.notif-toggle.on .notif-knob { transform:translateX(18px); }
.notif-toggle.loading { opacity:.45; cursor:default; }

/* ── Notification alert dot on menu button ── */
.notif-alert-dot { position:absolute; top:4px; right:4px; width:10px; height:10px; border-radius:50%; background:#ef4444; box-shadow:0 0 6px rgba(239,68,68,.6); }

/* SEO: visually-hidden H1 for crawlers */
.seo-h1{position:absolute;left:-9999px;top:auto;width:1px;height:1px;overflow:hidden}
