
/* =========================================================================
   DESIGN TOKENS — Minimal Light Theme
   ========================================================================= */
:root {
  /* ============================================================
     INNERBLOOM design tokens
     Botanical-warm palette: parchment surfaces, deep ink text,
     sage-green accent (growth), apricot secondary (warmth).
     ============================================================ */

  /* Surfaces — warm off-whites, never grey */
  --bg-base: #faf8f4;        /* parchment */
  --bg-1:    #f3efe7;        /* slightly darker for sidebar */
  --bg-2:    #ebe6db;        /* chips, hover swatches */
  --bg-glass: rgba(255, 253, 248, 0.88);
  --bg-glass-strong: rgba(255, 253, 248, 0.96);
  --surface: #ffffff;
  --surface-hover: #fbf9f4;
  --bg-elev: #ffffff;

  /* Text */
  --text: #18181b;
  --text-muted: #52525b;
  --text-dim: #a1a1aa;

  /* Accent — single indigo, no gradients */
  --accent: #b95116;
  --accent-2: #cf692b;
  --accent-3: #d7824d;
  --accent-soft: rgba(219,94,18,0.08);
  --accent-grad: #b95116;
  --warm-grad: #b95116;

  /* Borders */
  --border: #e5e7eb;
  --border-strong: #d4d4d8;

  /* Shadows — subtle, light */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.03);
  --shadow:    0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.03);
  --shadow-lg: 0 12px 28px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
  --shadow-xl: 0 24px 48px rgba(0,0,0,0.10), 0 8px 16px rgba(0,0,0,0.05);
  --shadow-glow: 0 0 0 3px rgba(219,94,18,0.15);

  /* Semantic */
  --success: #16a34a;
  --warning: #ca8a04;
  --danger: #dc2626;

  /* Emotion dots */
  --e-happy: #f59e0b;      --e-sad: #3b82f6;
  --e-anxious: #ef4444;    --e-calm: #10b981;
  --e-grateful: #a855f7;   --e-frustrated: #f97316;
  --e-excited: #eab308;    --e-reflective: #cf692b;
  --e-hopeful: #34d399;    --e-tired: #94a3b8;
  --e-angry: #dc2626;      --e-content: #86efac;
  --e-lonely: #9ca3af;     --e-proud: #f59e0b;
  --e-overwhelmed: #fca5a5;--e-neutral: #a1a1aa;

  --radius-sm: 8px; --radius: 12px; --radius-lg: 16px; --radius-xl: 24px;
  /* Tokens used by People, month-ago and persona components */
  --text-on-accent: #ffffff;
  --accent-deep: #8f3c0f;
  --accent-soft-strong: rgba(219,94,18,0.16);
  --warm: #cf692b;
  --warm-2: #d7824d;
  --warm-soft: rgba(207,105,43,0.10);
  --bg-warm-ink: #1f1d18;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg-base); color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  position: relative;
}
::selection { background: rgba(219,94,18,0.15); color: var(--text); }

/* scrollbars — warm, subtle */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(48, 38, 24, 0.12); border-radius: 8px;
  border: 2px solid transparent; background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(48, 38, 24, 0.22); background-clip: padding-box; }

/* =========================================================================
   LAYOUT
   ========================================================================= */
.app { display: grid; grid-template-columns: 240px 1fr; height: 100vh; position: relative; z-index: 1; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 18px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.brand-logo {
  width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(150deg, var(--accent) 0%, var(--accent-deep) 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(47, 82, 56, 0.25), inset 0 1px 0 rgba(255,255,255,0.18);
  position: relative;
  flex-shrink: 0;
}
.brand-logo::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.18), transparent 55%);
  pointer-events: none;
}
.brand-logo svg { width: 22px; height: 22px; color: white; position: relative; z-index: 1; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text .title { font-family: 'Urbanist', sans-serif; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; color: var(--text); }
.brand-text .sub { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.14em; margin-top: 1px; }

.nav-section-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--text-dim); padding: 16px 10px 5px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  color: var(--text-muted); cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
  font-weight: 500; font-size: 13px; user-select: none; position: relative;
}
.nav-item:hover { background: rgba(0,0,0,0.04); color: var(--text); }
.nav-item:focus-visible { outline: none; box-shadow: var(--shadow-glow); }
.nav-item.active {
  background: var(--accent-soft); color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
  font-weight: 600;
}
.nav-item.active svg { color: var(--accent); }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; transition: color 0.12s; color: var(--text-dim); }
.nav-item:hover svg { color: var(--text); }
.nav-item .kbd {
  margin-left: auto; font-size: 10px; color: var(--text-dim);
  font-family: ui-monospace, monospace;
  background: var(--bg-2); border: 1px solid var(--border);
  padding: 1px 5px; border-radius: 4px;
}
.nav-item .dot-indicator { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }

.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.streak-card {
  padding: 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: transform 0.12s, background 0.12s;
  box-shadow: var(--shadow-xs);
}
.streak-card:hover { transform: translateY(-1px); background: var(--surface-hover); }
.streak-card .label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 600; }
.streak-card .num { font-family: 'Urbanist', sans-serif; font-size: 28px; font-weight: 600; margin-top: 3px; line-height: 1; color: var(--text); }
.streak-card .num .unit { font-size: 11px; color: var(--text-muted); font-family: 'Urbanist', sans-serif; margin-left: 4px; font-weight: 400; }
.streak-card .sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Main ---------- */
.main { overflow-y: auto; position: relative; background: var(--bg-base); }
.topbar {
  position: sticky; top: 0; z-index: 10; padding: 22px 44px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(250, 248, 244, 0.85);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 {
  font-family: 'Urbanist', sans-serif; font-size: 23px; font-weight: 500;
  letter-spacing: -0.02em; line-height: 1.1; color: var(--text);
}
.topbar .greeting { color: var(--text-muted); font-size: 13px; margin-top: 4px; letter-spacing: 0.005em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.content { padding: 32px 40px 100px; max-width: 1100px; margin: 0 auto; }
.view { display: none; animation: fadeIn 0.2s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================================================
   PRIMITIVES
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 10px;
  background: var(--bg-elev); color: var(--text);
  border: 1.5px solid var(--border);
  font: inherit; font-weight: 500; font-size: 13px;
  cursor: pointer; user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease, color 0.15s ease;
  box-shadow: var(--shadow-xs);
  white-space: nowrap;
}
.btn:hover { background: var(--bg-2); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-glow), var(--shadow-xs); }
.btn svg { width: 14px; height: 14px; }
.btn-primary {
  background: var(--accent-grad); border: none; color: white;
  box-shadow: 0 4px 14px rgba(219,94,18,0.28);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(219,94,18,0.4); background: var(--accent-grad); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); box-shadow: none; }
.btn-ghost:hover { background: rgba(219,94,18,0.06); color: var(--text); border-color: var(--border); box-shadow: none; }
.btn-danger { color: var(--danger); border-color: rgba(220,38,38,0.2); }
.btn-danger:hover { background: rgba(220,38,38,0.05); border-color: rgba(220,38,38,0.3); }
.btn-spotify { background: #1db954; border: none; color: white; box-shadow: 0 4px 14px rgba(29,185,84,0.3); }
.btn-spotify:hover { background: #1ed760; transform: translateY(-1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.glass-card:hover { box-shadow: var(--shadow-lg); border-color: var(--border-strong); }

.card {
  background: var(--bg-elev); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.card h3 { font-family: 'Urbanist', sans-serif; font-size: 18px; font-weight: 500; margin-bottom: 10px; }

.input, .textarea, .select {
  width: 100%; background: var(--bg-elev); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 10px;
  padding: 10px 13px; font: inherit; font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-xs);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: var(--shadow-glow), var(--shadow-xs);
}
.input::placeholder, .textarea::placeholder { color: var(--text-dim); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  background: var(--bg-2); border: 1px solid var(--border);
  font-size: 11px; color: var(--text-muted); font-weight: 500;
}
.badge.green { background: rgba(22,163,74,0.10); border-color: rgba(22,163,74,0.25); color: var(--success); }
.badge.red { background: rgba(220,38,38,0.10); border-color: rgba(220,38,38,0.25); color: var(--danger); }

/* Insight refresh badge — small spinner + counter on the topbar */
.insight-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(196, 126, 42, 0.08);
  border-color: rgba(196, 126, 42, 0.22);
  color: var(--warning);
  cursor: pointer; user-select: none;
}
.insight-badge .spinner {
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid rgba(196, 126, 42, 0.25);
  border-top-color: var(--warning);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.kbd-inline {
  font-family: ui-monospace, monospace; font-size: 10px; color: var(--text-muted);
  background: rgba(219,94,18,0.06); border: 1px solid var(--border);
  padding: 1px 5px; border-radius: 4px;
}

/* =========================================================================
   WRITE VIEW
   ========================================================================= */
.write-wrap { display: flex; flex-direction: column; gap: 18px; max-width: 880px; margin: 0 auto; width: 100%; }

/* --- Month-ago trigger pill (small, unobtrusive — opens modal on click) --- */
.anniv-pill {
  display: inline-flex; align-items: center; gap: 9px;
  align-self: flex-start;
  padding: 8px 14px 8px 12px;
  background: linear-gradient(135deg, rgba(79, 124, 90, 0.07), rgba(217, 122, 91, 0.05));
  border: 1px solid rgba(79, 124, 90, 0.22);
  border-radius: 999px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
  box-shadow: var(--shadow-sm);
}
.anniv-pill:hover {
  background: linear-gradient(135deg, rgba(79, 124, 90, 0.12), rgba(217, 122, 91, 0.08));
  border-color: rgba(79, 124, 90, 0.38);
  transform: translateY(-1px);
}
.anniv-pill:focus-visible { outline: none; box-shadow: var(--shadow-glow); }
.anniv-pill svg { width: 14px; height: 14px; color: var(--accent); flex-shrink: 0; }
.anniv-pill-label { color: var(--accent-deep); font-weight: 600; }
.anniv-pill-meta { color: var(--text-muted); font-weight: 400; }
.anniv-pill-meta:not(:empty)::before { content: "·"; margin: 0 6px; color: var(--text-dim); }
.anniv-pill-arrow { color: var(--text-dim); margin-left: 2px; transition: transform 0.14s ease; }
.anniv-pill:hover .anniv-pill-arrow { transform: translateX(2px); color: var(--accent); }

/* --- Month-ago modal contents (sits inside .modal-backdrop) --- */
.anniv-modal {
  background: var(--bg-elev);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 720px; max-height: 88vh;
  overflow-y: auto;
  padding: 30px 32px 26px;
  box-shadow: var(--shadow-xl);
  position: relative;
}
.anniv-modal::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--accent), var(--warm));
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
}
.anniv-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 18px;
}
.anniv-eyebrow {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.16em;
  font-weight: 700; color: var(--accent);
}
.anniv-title {
  font-family: 'Urbanist', sans-serif; font-size: 22px; color: var(--text);
  letter-spacing: -0.01em; margin-top: 3px; line-height: 1.25;
}
.anniv-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px;
}
@media (max-width: 720px) { .anniv-grid { grid-template-columns: 1fr; } }
.anniv-col {
  background: rgba(255, 253, 248, 0.7);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
}
.anniv-col-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-dim); font-weight: 700; margin-bottom: 8px;
}
.anniv-col-emo {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Urbanist', sans-serif; font-size: 16px; color: var(--text);
  text-transform: capitalize;
}
.anniv-col-emo .dot {
  width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(255,255,255,0.7);
}
.anniv-col-meta {
  font-size: 12px; color: var(--text-muted); margin-top: 4px;
}
.anniv-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.anniv-tag {
  font-size: 10.5px; padding: 2px 8px; border-radius: 10px;
  background: var(--bg-2); color: var(--text-muted);
}
.anniv-reflect {
  display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px;
  margin-top: 12px; align-items: baseline;
  padding: 14px 16px;
  background: rgba(79, 124, 90, 0.04);
  border: 1px solid rgba(79, 124, 90, 0.12);
  border-radius: 12px;
}
.anniv-reflect-key {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em;
  font-weight: 700; color: var(--accent);
}
.anniv-reflect-val {
  font-size: 13.5px; color: var(--text); line-height: 1.6;
}
.anniv-reflect-val em { color: var(--accent-deep); font-style: normal; font-weight: 500; }
.anniv-reflect-loading {
  padding: 14px 16px;
  background: rgba(79, 124, 90, 0.04);
  border: 1px dashed rgba(79, 124, 90, 0.18);
  border-radius: 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 12px;
  display: flex; align-items: center; gap: 10px;
}
.anniv-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* --- Prompt card --- */
.prompt-card {
  background: linear-gradient(135deg, rgba(219,94,18,0.06) 0%, rgba(213,107,40,0.04) 100%);
  border: 1.5px solid rgba(219,94,18,0.15); padding: 20px 24px;
  border-radius: var(--radius-lg); display: flex; gap: 16px; align-items: flex-start;
  box-shadow: var(--shadow-sm);
}
.prompt-card .dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  margin-top: 10px; flex-shrink: 0;
  box-shadow: 0 0 10px rgba(219,94,18,0.4);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.55; transform: scale(0.86); } }
.prompt-card .label {
  font-size: 10.5px; color: var(--accent); text-transform: uppercase;
  letter-spacing: 0.16em; font-weight: 700; margin-bottom: 7px;
}
.prompt-card .text {
  font-family: 'Urbanist', sans-serif; font-size: 18px; font-style: italic;
  color: var(--text); line-height: 1.5;
}

/* --- Editor --- */
.editor {
  background: var(--bg-elev); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 30px 32px 22px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.editor:focus-within { border-color: var(--accent-3); box-shadow: var(--shadow); }
.editor-meta-row { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.entry-title-input {
  background: transparent; border: none; color: var(--text);
  font-family: 'Urbanist', sans-serif; font-size: 24px; font-weight: 500;
  flex: 1; min-width: 200px; letter-spacing: -0.02em;
}
.entry-title-input::placeholder { color: var(--text-dim); font-weight: 400; }
.entry-title-input:focus { outline: none; }

.journal-textarea {
  width: 100%; min-height: 320px; background: transparent; border: none;
  color: var(--text); font: inherit; font-size: 16px; line-height: 1.8;
  resize: vertical; font-family: 'Urbanist', sans-serif;
}
.journal-textarea::placeholder { color: var(--text-dim); font-style: italic; }
.journal-textarea:focus { outline: none; }

.editor-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 18px; margin-top: 16px; border-top: 1px solid var(--border);
  gap: 10px; flex-wrap: wrap;
}
.editor-stats { color: var(--text-dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.editor-stats .auto { margin-left: 12px; color: var(--text-muted); }
.editor-buttons { display: flex; gap: 8px; align-items: center; }

.mic-btn {
  width: 36px; height: 36px; border-radius: 50%; background: var(--bg-elev);
  border: 1.5px solid var(--border); color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease; box-shadow: var(--shadow-xs);
}
.mic-btn:hover { border-color: var(--accent); color: var(--accent); box-shadow: var(--shadow-sm); }
.mic-btn.listening { background: var(--danger); color: white; border-color: var(--danger); animation: pulse 1.5s infinite; }
.mic-btn svg { width: 15px; height: 15px; }

/* =========================================================================
   ENTRIES VIEW
   ========================================================================= */
.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; max-width: 460px; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-dim); pointer-events: none; }
.search-wrap .input { padding-left: 38px; }

.chip {
  padding: 6px 13px; border-radius: 20px; background: var(--bg-elev);
  border: 1.5px solid var(--border); font-size: 12px; color: var(--text-muted);
  cursor: pointer; transition: all 0.15s ease; user-select: none;
  display: inline-flex; align-items: center; gap: 6px;
  box-shadow: var(--shadow-xs); font-weight: 500;
}
.chip:hover { background: var(--bg-2); border-color: var(--border-strong); color: var(--text); }
.chip.active { background: rgba(219,94,18,0.1); border-color: rgba(219,94,18,0.3); color: var(--accent); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; }

.month-group-label {
  font-family: 'Urbanist', sans-serif; font-size: 14px; font-weight: 500;
  color: var(--text-muted); margin: 24px 0 10px;
  padding-bottom: 8px; border-bottom: 1.5px solid var(--border);
  letter-spacing: -0.01em;
}

.entry-card {
  background: var(--bg-elev); border: 1.5px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 22px; margin-bottom: 10px; cursor: pointer;
  transition: all 0.18s ease; position: relative;
  box-shadow: var(--shadow-xs);
}
.entry-card::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-grad);
  opacity: 0; transition: opacity 0.15s ease;
}
.entry-card:hover {
  border-color: rgba(219,94,18,0.2); transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.entry-card:hover::before { opacity: 1; }
.entry-card .row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.entry-card .date { font-size: 11.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.entry-card .emo-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px;
  padding: 3px 10px; border-radius: 20px; color: var(--text-muted);
  border: 1px solid var(--border); background: var(--bg-2); font-weight: 500;
}
.entry-card .emo-pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.entry-card .title {
  font-family: 'Urbanist', sans-serif; font-size: 17px; font-weight: 500;
  color: var(--text); margin-bottom: 5px; line-height: 1.35;
}
.entry-card .snippet {
  color: var(--text-muted); font-size: 13px; line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.entry-card .tags { display: flex; gap: 5px; margin-top: 10px; flex-wrap: wrap; }
.entry-card .tag {
  font-size: 10.5px; padding: 3px 9px; border-radius: 20px;
  background: rgba(219,94,18,0.07); color: var(--accent);
  border: 1px solid rgba(219,94,18,0.15); font-weight: 500;
}

/* =========================================================================
   MODAL (ENTRY VIEW + EDIT)
   ========================================================================= */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(24,24,27,0.35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.modal-backdrop.active { display: flex; animation: fadeIn 0.2s ease; }
.modal {
  background: var(--bg-elev); border: 1.5px solid var(--border); border-radius: var(--radius-xl);
  width: 100%; max-width: 720px; max-height: 88vh;
  overflow-y: auto; padding: 32px;
  box-shadow: var(--shadow-xl);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; gap: 14px; }
.modal h2 { font-family: 'Urbanist', sans-serif; font-weight: 500; font-size: 26px; line-height: 1.25; color: var(--text); }
.modal .meta { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); margin-top: 6px; flex-wrap: wrap; align-items: center; }
.modal .body {
  font-family: 'Urbanist', sans-serif; font-size: 16px; line-height: 1.8;
  color: var(--text); white-space: pre-wrap;
  padding: 20px 0; border-top: 1.5px solid var(--border); border-bottom: 1.5px solid var(--border);
  margin: 14px 0 20px;
}
.modal .body.editing {
  background: rgba(219,94,18,0.03); border-radius: 10px; padding: 16px;
  border: 1.5px dashed rgba(219,94,18,0.25); outline: none;
}
.modal .section-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-dim); margin: 16px 0 8px; font-weight: 700; }

.reflect-q {
  padding: 12px 15px; background: rgba(219,94,18,0.04);
  border: 1.5px solid rgba(219,94,18,0.12); border-radius: 10px;
  margin-bottom: 8px; font-family: 'Urbanist', sans-serif;
  font-style: italic; color: var(--text); font-size: 14.5px; line-height: 1.55;
}

.related-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 13px;
  background: var(--bg-2); border: 1.5px solid var(--border); border-radius: 10px;
  margin-bottom: 6px; cursor: pointer; transition: all 0.15s ease;
}
.related-item:hover { border-color: rgba(219,94,18,0.25); background: var(--bg-elev); box-shadow: var(--shadow-sm); }
.related-item .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.related-item .title { font-size: 13px; color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.related-item .date { font-size: 11px; color: var(--text-dim); flex-shrink: 0; }

.modal-actions { display: flex; gap: 8px; margin-top: 20px; justify-content: flex-end; flex-wrap: wrap; }

/* =========================================================================
   CHAT VIEW
   ========================================================================= */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 148px); min-height: 500px; }
.chat-feed {
  flex: 1; overflow-y: auto; padding: 24px 8px;
  display: flex; flex-direction: column; gap: 16px;
  /* No scroll-behavior:smooth — streaming chunks fire scrollTop dozens of
     times per second and smooth scrolling stacks the animations, producing
     the "scroll from top to bottom" feeling. We do instant pinning in JS,
     and only when the user is already near the bottom. */
}

/* === Chat top-bar: mode toggle + personality picker === */
.chat-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 8px 12px; border-bottom: 1px solid var(--border);
}
/* .mode-switch retained for back-compat with any cached state; the
   General toggle is no longer rendered. */
.mode-switch { display: none; }
.mode-switch button {
  background: transparent; border: 0; padding: 6px 14px; border-radius: 9px;
  font: inherit; font-size: 12.5px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; transition: all 0.15s ease;
}
.mode-switch button.active { background: var(--accent-grad); color: white; box-shadow: 0 2px 8px rgba(219,94,18,0.25); }
.persona-picker {
  display: flex; gap: 6px; align-items: stretch;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px;
  padding: 4px; box-shadow: var(--shadow-xs);
}
.persona-pill {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 6px 12px; border-radius: 10px;
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  font: inherit; text-align: left; min-width: 110px;
}
.persona-pill .p-name { font-size: 13px; font-weight: 600; color: var(--text-muted); line-height: 1.2; }
.persona-pill .p-desc { font-size: 10.5px; color: var(--text-dim); margin-top: 1px; line-height: 1.3; }
.persona-pill:hover { background: var(--bg-1); }
.persona-pill:hover .p-name { color: var(--text); }
.persona-pill.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  box-shadow: 0 2px 8px rgba(47, 82, 56, 0.18), inset 0 1px 0 rgba(255,255,255,0.10);
}
.persona-pill.active .p-name { color: white; }
.persona-pill.active .p-desc { color: rgba(255,255,255,0.78); }
.persona-pill:focus-visible { outline: none; box-shadow: var(--shadow-glow); }

@media (max-width: 760px) {
  .persona-pill .p-desc { display: none; }
  .persona-pill { min-width: 0; padding: 6px 10px; }
}

.chat-bar .spacer { flex: 1; }
.chat-bar .hint { font-size: 11.5px; color: var(--text-dim); }

/* === Markdown inside AI messages === */
.msg.ai .md p { margin: 0 0 8px; }
.msg.ai .md p:last-child { margin-bottom: 0; }
.msg.ai .md strong { color: var(--text); font-weight: 600; }
.msg.ai .md em { color: var(--text); font-style: italic; }
.msg.ai .md ul, .msg.ai .md ol { margin: 4px 0 8px; padding-left: 22px; }
.msg.ai .md li { margin: 2px 0; }
.msg.ai .md code {
  background: rgba(219,94,18,0.10); padding: 1px 6px; border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
}
.msg.ai .md pre {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; overflow-x: auto; margin: 6px 0;
}
.msg.ai .md pre code { background: transparent; padding: 0; font-size: 12px; }
.msg.ai .md a { color: var(--accent); text-decoration: underline; }
.msg.ai .md h1, .msg.ai .md h2, .msg.ai .md h3 { font-size: 15px; font-weight: 600; margin: 10px 0 4px; color: var(--text); }

/* === Agent working steps === */
.agent-steps {
  display: flex; flex-direction: column; gap: 5px;
  max-width: 82%; align-self: flex-start;
  margin: 2px 0 -8px;
  border-left: 2px solid rgba(219,94,18,0.18);
  padding-left: 12px;
}
.agent-steps.collapsed .agent-step:not(.summary) { display: none; }
.agent-step {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 9px;
  background: var(--bg-elev); border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: var(--text-muted);
  transition: opacity 0.18s ease;
}
.agent-step.summary {
  cursor: pointer;
  background: transparent; border-color: transparent;
  color: var(--text-dim); font-size: 11.5px;
  padding: 2px 4px;
}
.agent-step.summary::before { content: "▸"; margin-right: 4px; transition: transform 0.15s ease; }
.agent-steps:not(.collapsed) .agent-step.summary::before { transform: rotate(90deg); }
.agent-step .icon {
  width: 14px; height: 14px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.agent-step.running .icon::before {
  content: ""; width: 10px; height: 10px;
  border: 2px solid var(--accent); border-top-color: transparent;
  border-radius: 50%; animation: agentSpin 0.85s linear infinite;
}
.agent-step.done .icon::before { content: "✓"; color: var(--accent); font-weight: 700; font-size: 13px; }
@keyframes agentSpin { to { transform: rotate(360deg); } }
.agent-step .label { color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-step .detail {
  color: var(--text-dim); font-size: 11px;
  max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* === Show-more button (insights overflow) === */
.show-more-btn {
  align-self: center; margin-top: 6px;
  padding: 8px 18px; border-radius: 20px;
  background: var(--bg-elev); border: 1.5px solid var(--border); color: var(--text-muted);
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  letter-spacing: 0.02em;
}
.show-more-btn:hover {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
}
.show-more-btn--grid { grid-column: 1 / -1; justify-self: center; }

/* === Contradiction insight cards === */
.contradiction-list { display: flex; flex-direction: column; gap: 12px; }
.contradiction-card {
  border-radius: 14px; padding: 16px 18px;
  background: var(--bg-elev); border: 1.5px solid var(--border);
  box-shadow: var(--shadow-xs); display: flex; flex-direction: column; gap: 10px;
}
.contradiction-card .head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-dim); font-weight: 700;
}
.contradiction-card .pattern-tag {
  background: rgba(219,94,18,0.10); color: var(--accent);
  border: 1px solid rgba(219,94,18,0.22);
  padding: 2px 9px; border-radius: 99px; font-size: 10.5px; letter-spacing: 0.04em;
}
.contradiction-card .sev { padding: 2px 9px; border-radius: 99px; font-size: 10.5px; letter-spacing: 0.04em; }
.contradiction-card .sev.low    { background: rgba(34,197,94,0.10);  color: #16a34a; border: 1px solid rgba(34,197,94,0.25); }
.contradiction-card .sev.medium { background: rgba(234,179,8,0.10);  color: #ca8a04; border: 1px solid rgba(234,179,8,0.25); }
.contradiction-card .sev.high   { background: rgba(244,63,94,0.10);  color: #e11d48; border: 1px solid rgba(244,63,94,0.25); }
.contradiction-card .pair { display: flex; flex-direction: column; gap: 6px; }
.contradiction-card .line {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 14px; color: var(--text); line-height: 1.55;
}
.contradiction-card .line .marker {
  flex-shrink: 0; width: 56px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim);
  padding-top: 3px;
}
.contradiction-card .line.stated   .marker { color: var(--accent); }
.contradiction-card .line.behavior .marker { color: #e11d48; }
.contradiction-card .note {
  font-size: 13px; color: var(--text-muted); line-height: 1.55;
  border-top: 1px solid var(--border); padding-top: 10px; font-style: italic;
}
.contradictions-meta {
  font-size: 12px; color: var(--text-dim);
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.contradictions-empty {
  font-size: 13.5px; color: var(--text-muted); padding: 20px 0; text-align: center;
}

/* === Trigger map cards === */
.trigger-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.trigger-card {
  border-radius: 14px; padding: 14px 16px;
  background: var(--bg-elev); border: 1.5px solid var(--border);
  box-shadow: var(--shadow-xs);
  display: flex; flex-direction: column; gap: 10px; min-height: 0;
}
.trigger-card.negative { border-left: 3px solid #e11d48; }
.trigger-card.positive { border-left: 3px solid #16a34a; }
.trigger-card .head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-dim); font-weight: 700;
}
.trigger-card .cat {
  background: rgba(219,94,18,0.10); color: var(--accent);
  border: 1px solid rgba(219,94,18,0.22);
  padding: 2px 9px; border-radius: 99px;
}
.trigger-card .dir {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 99px; font-weight: 700;
}
.trigger-card.negative .dir { background: rgba(244,63,94,0.10); color: #e11d48; border: 1px solid rgba(244,63,94,0.25); }
.trigger-card.positive .dir { background: rgba(34,197,94,0.10); color: #16a34a; border: 1px solid rgba(34,197,94,0.25); }
.trigger-card .freq { color: var(--text-muted); }
.trigger-card .title {
  font-size: 14.5px; color: var(--text); line-height: 1.45; font-weight: 500;
}
.trigger-card .title .arrow { color: var(--text-dim); margin: 0 6px; }
.trigger-card .title .outcome { color: var(--text-muted); font-weight: 400; }
.trigger-card .stats {
  display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--text-dim);
}
.trigger-card .stats .bar {
  flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; position: relative;
}
.trigger-card .stats .bar .fill {
  position: absolute; top: 0; bottom: 0; border-radius: 2px;
}
.trigger-card.negative .stats .bar .fill { background: #e11d48; right: 50%; }
.trigger-card.positive .stats .bar .fill { background: #16a34a; left: 50%; }
.trigger-card .stats .bar .axis {
  position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px;
  background: var(--border-strong);
}
.trigger-card .stats .delta { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; color: var(--text); }
.trigger-card .note {
  font-size: 12.5px; color: var(--text-muted); line-height: 1.55;
  border-top: 1px solid var(--border); padding-top: 9px; font-style: italic;
}
.triggers-empty { font-size: 13.5px; color: var(--text-muted); padding: 20px 0; text-align: center; }

/* === Wellbeing radar (burnout + spiral) === */
.wellbeing-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .wellbeing-row { grid-template-columns: 1fr; } }
.wellbeing-card {
  border-radius: 14px; padding: 16px 18px;
  background: var(--bg-elev); border: 1.5px solid var(--border);
  box-shadow: var(--shadow-xs);
  display: flex; flex-direction: column; gap: 10px;
  position: relative; overflow: hidden;
}
.wellbeing-card .level-strip {
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.wellbeing-card.ok       .level-strip { background: var(--success); }
.wellbeing-card.watch    .level-strip { background: var(--warning); }
.wellbeing-card.elevated .level-strip { background: var(--warm); }
.wellbeing-card.high     .level-strip { background: var(--danger); }
.wellbeing-card .head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
}
.wellbeing-card .name {
  font-family: 'Urbanist', sans-serif; font-size: 17px; font-weight: 500; color: var(--text);
}
.wellbeing-card .level {
  padding: 3px 12px; border-radius: 99px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.wellbeing-card.ok       .level { background: rgba(79, 124, 90, 0.10);   color: var(--success); border: 1px solid rgba(79, 124, 90, 0.25); }
.wellbeing-card.watch    .level { background: rgba(196, 126, 42, 0.12);  color: var(--warning); border: 1px solid rgba(196, 126, 42, 0.30); }
.wellbeing-card.elevated .level { background: rgba(217, 122, 91, 0.14);  color: var(--warm); border: 1px solid rgba(217, 122, 91, 0.30); }
.wellbeing-card.high     .level { background: rgba(196, 65, 58, 0.12);   color: var(--danger); border: 1px solid rgba(196, 65, 58, 0.30); }
.wellbeing-card .stats-row {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.wellbeing-card .stats-row .stat {
  display: inline-flex; gap: 6px;
}
.wellbeing-card .stats-row .stat b { color: var(--text); font-weight: 600; }
.wellbeing-card .summary {
  font-size: 13.5px; color: var(--text); line-height: 1.6;
}
.wellbeing-card .summary.muted { color: var(--text-muted); font-style: italic; }

/* === Identity & narrative === */
.narrative-card {
  border-radius: 14px; padding: 22px 24px;
  background: linear-gradient(180deg, var(--bg-elev), var(--bg));
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 18px;
}
.narrative-section .label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--text-dim); font-weight: 700; margin-bottom: 10px;
}
.narrative-identity {
  display: flex; flex-direction: column; gap: 6px;
  font-family: 'Urbanist', sans-serif; font-size: 18px; line-height: 1.55;
  color: var(--text);
}
.narrative-identity .line {
  padding: 6px 0; border-bottom: 1px dashed var(--border);
}
.narrative-identity .line:last-child { border-bottom: 0; }
.narrative-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.narrative-item {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 11px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.narrative-item .head {
  font-size: 13px; font-weight: 600; color: var(--text);
}
.narrative-item .head .value-tag {
  display: inline-block; background: rgba(219,94,18,0.10); color: var(--accent);
  border: 1px solid rgba(219,94,18,0.22);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 99px; margin-right: 6px;
}
.narrative-item .body { font-size: 13px; color: var(--text-muted); line-height: 1.55; }
.narrative-tension {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 11px;
  font-size: 13px; color: var(--text); line-height: 1.5;
}
.narrative-tension .a, .narrative-tension .b { flex: 1; }
.narrative-tension .vs { color: var(--text-dim); font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.narrative-becoming {
  font-family: 'Urbanist', sans-serif; font-size: 16px; color: var(--text);
  font-style: italic; line-height: 1.6;
  border-left: 3px solid var(--accent); padding: 4px 0 4px 16px;
}
.narrative-empty { font-size: 13.5px; color: var(--text-muted); padding: 28px 0; text-align: center; }

/* === Memory graph === */
.graph-wrap {
  position: relative;
  height: calc(100vh - 180px); min-height: 520px;
  border-radius: 14px;
  background: var(--bg-elev); border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
#graph-canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#graph-canvas:active { cursor: grabbing; }
.graph-toolbar {
  position: absolute; top: 14px; left: 14px;
  display: flex; gap: 8px; align-items: center;
  background: rgba(255,255,255,0.92); backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px;
  font-size: 11.5px; color: var(--text-muted);
}
.graph-toolbar b { color: var(--text); font-weight: 600; }
.graph-tip {
  position: absolute; pointer-events: none;
  background: rgba(255,255,255,0.96); backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px;
  font-size: 12px; color: var(--text); line-height: 1.45;
  max-width: 280px; box-shadow: var(--shadow);
  display: none;
}
.graph-tip .meta { color: var(--text-dim); font-size: 10.5px; margin-top: 2px; }
.graph-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 14px;
}
.graph-tool-sub { color: var(--text-dim); margin-left: 6px; }
.graph-legend {
  position: absolute; top: 14px; right: 14px;
  display: flex; flex-direction: column; gap: 6px;
  background: rgba(255,255,255,0.94); backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; max-width: 260px;
  font-size: 12px; box-shadow: var(--shadow-sm);
  max-height: calc(100% - 28px); overflow-y: auto;
}
.graph-legend-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-dim); font-weight: 700; margin-bottom: 4px;
}
.graph-legend-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px; margin: 0 -6px;
  border-radius: 6px; cursor: pointer; transition: background 0.12s;
}
.graph-legend-row:hover { background: rgba(219,94,18,0.06); }
.graph-legend-row.muted { opacity: 0.35; }
.graph-legend-row.muted:hover { opacity: 0.6; }
.graph-legend-swatch {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0; box-shadow: 0 0 0 2px rgba(255,255,255,0.85);
}
.graph-legend-name {
  font-size: 12px; color: var(--text); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
}
.graph-legend-count {
  font-size: 10.5px; color: var(--text-dim);
  background: var(--bg); padding: 1px 6px; border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

/* === People view === */
.people-header {
  font-size: 13.5px; color: var(--text-muted); line-height: 1.6;
  margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.people-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.person-card {
  background: var(--bg-elev); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  display: flex; flex-direction: column; gap: 14px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.person-card:hover {
  box-shadow: var(--shadow); border-color: var(--border-strong);
  transform: translateY(-1px);
}
.person-head { display: flex; gap: 14px; align-items: center; }
.person-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Urbanist', sans-serif; font-size: 22px; font-weight: 600; color: white;
  box-shadow: 0 4px 12px rgba(48,38,24,0.18), inset 0 1px 0 rgba(255,255,255,0.2);
  flex-shrink: 0; transition: transform 0.2s ease;
}
.person-info { flex: 1; min-width: 0; }
.person-name {
  font-family: 'Urbanist', sans-serif; font-size: 20px; font-weight: 500;
  color: var(--text); letter-spacing: -0.01em; line-height: 1.2;
}
.person-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.person-meta b { color: var(--text); font-weight: 600; }
.person-emo-list { display: flex; flex-direction: column; gap: 5px; }
.person-emo-row {
  display: grid; grid-template-columns: 14px 80px 1fr 38px;
  gap: 8px; align-items: center;
  font-size: 11.5px;
}
.person-emo-row .dot { width: 8px; height: 8px; border-radius: 50%; }
.person-emo-name { color: var(--text); text-transform: capitalize; font-weight: 500; }
.person-emo-bar { background: var(--bg-1); height: 4px; border-radius: 2px; overflow: hidden; }
.person-emo-fill { height: 100%; border-radius: 2px; }
.person-emo-pct { color: var(--text-muted); font-variant-numeric: tabular-nums; text-align: right; }
.person-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.person-entries { display: flex; gap: 5px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--border); }
.person-card { cursor: pointer; }

/* People CRM: status chips + detail drawer */
.person-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.person-chip {
  font-size: 10.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--border); color: var(--text-muted); background: var(--bg-1);
  text-transform: capitalize;
}
.person-chip.rel      { background: var(--accent-soft); color: var(--accent-deep); border-color: rgba(79,124,90,0.22); }
.person-chip.overdue  { background: rgba(196,65,58,0.10);  color: var(--danger);  border-color: rgba(196,65,58,0.28); }
.person-chip.bday     { background: rgba(196,126,42,0.12); color: var(--warning); border-color: rgba(196,126,42,0.30); }
.person-chip.pin      { background: rgba(217,122,91,0.12); color: var(--warm);    border-color: rgba(217,122,91,0.30); }

.pm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .pm-grid { grid-template-columns: 1fr; } }
.pm-field { display: flex; flex-direction: column; gap: 5px; }
.pm-field label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-dim); font-weight: 700; }
.pm-note-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 6px;
}
.pm-note-body { flex: 1; min-width: 0; }
.pm-note-text { font-size: 13px; color: var(--text); line-height: 1.5; white-space: pre-wrap; }
.pm-note-date { font-size: 10.5px; color: var(--text-dim); margin-top: 3px; }
.pm-note-del {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 2px 4px; flex-shrink: 0;
}
.pm-note-del:hover { color: var(--danger); }
.pm-note-empty { font-size: 12.5px; color: var(--text-muted); font-style: italic; padding: 6px 0; }
.pm-add-row { display: flex; gap: 8px; margin-top: 8px; }
.pm-add-row .input { flex: 1; }
.cadence-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cadence-chip {
  font-size: 12px; font-weight: 500; padding: 6px 13px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--bg-1); color: var(--text-muted);
  cursor: pointer; transition: all 0.15s ease;
}
.cadence-chip:hover { border-color: var(--border-strong); color: var(--text); }
.cadence-chip.active {
  background: var(--accent-soft); color: var(--accent-deep);
  border-color: rgba(79,124,90,0.35); font-weight: 600;
}
.pm-contact-line { font-size: 12px; color: var(--text-muted); margin-top: 10px; }

/* === Music: simple hour-of-day bar chart === */
.hour-bars {
  display: flex; align-items: flex-end; gap: 3px; height: 72px;
  padding-top: 6px;
}
.hour-bars .hour-col { flex: 1; display: flex; align-items: flex-end; }
.hour-bars .hour-col .bar {
  width: 100%; background: var(--accent);
  border-radius: 3px 3px 0 0; min-height: 2px;
  transition: opacity 0.15s;
}
.hour-axis {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--text-dim);
  margin-top: 6px;
}
.hour-meta {
  font-size: 11.5px; color: var(--text-muted); margin-top: 12px;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.hour-meta b { color: var(--accent); font-weight: 600; }
.empty-line { color: var(--text-muted); font-size: 13px; }

/* === Crisis / distress safety card === */
.safety-card {
  border-radius: 14px; padding: 14px 16px; margin: 4px 0 10px;
  background: linear-gradient(180deg, rgba(244,114,182,0.07), rgba(244,114,182,0.02));
  border: 1.5px solid rgba(244,114,182,0.35);
  align-self: stretch; max-width: 82%;
}
.safety-card.soft { border-color: rgba(244,114,182,0.22); }
.safety-card .title { font-weight: 600; color: var(--text); font-size: 13.5px; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.safety-card .title::before { content: "♥"; color: #f472b6; }
.safety-card .body { font-size: 13px; color: var(--text); line-height: 1.55; margin-bottom: 10px; }
.safety-card .resources { display: grid; gap: 6px; }
.safety-card .resource {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; font-size: 12.5px;
}
.safety-card .resource .name { font-weight: 500; color: var(--text); }
.safety-card .resource .detail { color: var(--text-muted); }

.msg {
  max-width: 76%; padding: 14px 18px; border-radius: 18px;
  font-size: 14.5px; line-height: 1.7; animation: msgIn 0.22s ease;
  white-space: pre-wrap; word-wrap: break-word;
  position: relative;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.msg.user {
  align-self: flex-end; background: var(--accent-grad); color: white;
  border-bottom-right-radius: 4px; box-shadow: 0 4px 16px rgba(219,94,18,0.25);
}
.msg.ai {
  align-self: flex-start; background: var(--bg-elev);
  border: 1px solid var(--border); border-bottom-left-radius: 6px;
  max-width: 82%; color: var(--text); box-shadow: var(--shadow-sm);
}
.msg.ai .typing-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-dim); margin: 0 2px;
  animation: typingPulse 1.2s ease-in-out infinite;
}
.msg.ai .typing-dot:nth-child(2) { animation-delay: 0.15s; }
.msg.ai .typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingPulse {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.cite-row { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.cite-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 20px;
  background: rgba(219,94,18,0.08); color: var(--accent);
  border: 1px solid rgba(219,94,18,0.18);
  font-size: 11px; cursor: pointer; transition: all 0.15s ease;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600; letter-spacing: 0.01em;
  box-shadow: var(--shadow-xs);
}
.cite-pill:hover { background: rgba(219,94,18,0.15); border-color: rgba(219,94,18,0.3); }
.cite-pill .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.chat-welcome { text-align: center; padding: 60px 20px 40px; }
.chat-welcome h3 { font-family: 'Urbanist', sans-serif; font-size: 30px; color: var(--text); font-weight: 500; margin-bottom: 10px; }
.chat-welcome p { max-width: 440px; margin: 0 auto 24px; font-size: 14px; color: var(--text-muted); line-height: 1.65; }
.suggest-wrap { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; max-width: 620px; margin: 0 auto; }
.suggest {
  padding: 10px 16px; background: var(--bg-elev); border: 1.5px solid var(--border);
  border-radius: 12px; font-size: 13px; cursor: pointer;
  transition: all 0.15s ease; color: var(--text); box-shadow: var(--shadow-xs);
  font-weight: 500;
}
.suggest:hover { background: var(--bg-2); border-color: rgba(219,94,18,0.3); box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.chat-input-wrap {
  border-top: 1.5px solid var(--border); padding: 16px 8px 4px;
  display: flex; gap: 10px; align-items: flex-end;
}
.chat-input {
  flex: 1; min-height: 48px; max-height: 200px; padding: 13px 16px;
  background: var(--bg-elev); border: 1.5px solid var(--border); border-radius: 14px;
  color: var(--text); font: inherit; font-size: 14px; resize: none; line-height: 1.5;
  box-shadow: var(--shadow-xs);
}
.chat-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-glow), var(--shadow-xs); }
.send-btn {
  width: 48px; height: 48px; border-radius: 14px; background: var(--accent-grad);
  border: none; color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(219,94,18,0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
}
.send-btn:hover { transform: translateY(-1px) scale(1.03); box-shadow: 0 6px 20px rgba(219,94,18,0.4); }
.send-btn svg { width: 18px; height: 18px; }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

/* =========================================================================
   INSIGHTS VIEW
   ========================================================================= */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-elev); border: 1.5px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 20px; box-shadow: var(--shadow-xs);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-3));
  opacity: 0; transition: opacity 0.2s ease;
}
.stat-card:hover {
  box-shadow: var(--shadow); border-color: var(--border-strong);
  transform: translateY(-1px);
}
.stat-card:hover::before { opacity: 1; }
.stat-card .label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-dim); font-weight: 700; }
.stat-card .value { font-family: 'Urbanist', sans-serif; font-size: 32px; font-weight: 500; margin-top: 6px; line-height: 1; color: var(--text); }
.stat-card .value .unit { font-size: 12px; color: var(--text-muted); margin-left: 4px; font-family: 'Urbanist', sans-serif; font-weight: 400; }
.stat-card .sub { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }

.insight-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .insight-row { grid-template-columns: 1fr; } }

.section-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 28px 0 14px; gap: 12px; flex-wrap: wrap;
}
.section-title h3 {
  font-family: 'Urbanist', sans-serif; font-size: 20px; font-weight: 500;
  color: var(--text); letter-spacing: -0.01em; line-height: 1.2;
}
.section-title .sub {
  font-size: 12px; color: var(--text-muted);
  font-weight: 400; letter-spacing: 0.01em;
}
.section-title-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.section-title:first-child { margin-top: 4px; }
.section-title-actions { display: flex; gap: 8px; }

.chart-box { height: 200px; display: flex; align-items: flex-end; gap: 3px; padding: 10px 0 0; position: relative; }
.chart-bar { flex: 1; background: var(--accent-grad); border-radius: 4px 4px 0 0; transition: opacity 0.15s ease; min-height: 2px; position: relative; opacity: 0.8; }
.chart-bar:hover { opacity: 1; }
.chart-bar.empty { background: var(--border); opacity: 0.6; }
.chart-bar .tip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: white; padding: 5px 9px; border-radius: 7px;
  font-size: 11px; white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity 0.15s; z-index: 2;
}
.chart-bar:hover .tip { opacity: 1; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 8px; color: var(--text-dim); font-size: 10.5px; }

.heatmap-wrap { overflow-x: auto; padding: 6px 0; }
.heatmap { display: grid; grid-template-rows: repeat(7, 11px); grid-auto-flow: column; grid-auto-columns: 11px; gap: 3px; }
.heat-cell { border-radius: 3px; background: rgba(219,94,18,0.06); cursor: pointer; position: relative; transition: transform 0.1s; }
.heat-cell:hover { transform: scale(1.4); z-index: 1; }
.heat-cell:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: white; padding: 4px 8px; border-radius: 6px;
  font-size: 11px; white-space: nowrap; z-index: 3; pointer-events: none;
}
.heatmap-legend { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 11px; color: var(--text-muted); }
.heatmap-legend .sq { width: 10px; height: 10px; border-radius: 2px; }

.emo-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.emo-bar-label { min-width: 100px; font-size: 12.5px; color: var(--text-muted); text-transform: capitalize; display: flex; align-items: center; gap: 7px; }
.emo-bar-label .dot { width: 8px; height: 8px; border-radius: 50%; }
.emo-bar-track { flex: 1; height: 7px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.emo-bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s cubic-bezier(0.4,0,0.2,1); }
.emo-bar-count { font-size: 12px; color: var(--text-dim); min-width: 26px; text-align: right; font-variant-numeric: tabular-nums; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-cloud .tag {
  padding: 5px 12px; border-radius: 20px; background: rgba(219,94,18,0.07);
  color: var(--accent); border: 1px solid rgba(219,94,18,0.15);
  font-size: 12px; cursor: pointer; font-weight: 500; transition: all 0.15s;
}
.tag-cloud .tag:hover { background: rgba(219,94,18,0.14); border-color: rgba(219,94,18,0.3); }

.analysis-box {
  background: linear-gradient(135deg, rgba(219,94,18,0.04) 0%, rgba(213,107,40,0.03) 100%);
  border: 1.5px solid rgba(219,94,18,0.12); border-radius: var(--radius-lg);
  padding: 22px 24px; font-size: 14px; line-height: 1.75;
  color: var(--text); white-space: pre-wrap; margin-top: 12px;
}
.analysis-box strong { color: var(--accent); font-weight: 600; }
.analysis-box.loading { color: var(--text-muted); font-style: italic; }

/* =========================================================================
   MUSIC VIEW
   ========================================================================= */
.music-hero {
  padding: 24px 28px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(29,185,84,0.07) 0%, rgba(219,94,18,0.05) 100%);
  border: 1.5px solid rgba(29,185,84,0.18); margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.music-hero .row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.music-hero .avatar { width: 50px; height: 50px; border-radius: 50%; overflow: hidden; background: var(--bg-2); box-shadow: var(--shadow-sm); }
.music-hero .avatar img { width: 100%; height: 100%; object-fit: cover; }
.music-hero h2 { font-family: 'Urbanist', sans-serif; font-size: 21px; font-weight: 500; color: var(--text); }
.music-hero .sub { color: var(--text-muted); font-size: 13px; margin-top: 3px; }

.mood-chart { background: var(--bg-elev); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 22px 24px; box-shadow: var(--shadow-sm); }
.mood-quadrant {
  background: var(--bg-elev); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px 24px; box-shadow: var(--shadow-sm);
}
.mood-quadrant-grid {
  display: grid; grid-template-columns: 1fr 280px; gap: 22px;
  align-items: start;
}
@media (max-width: 860px) {
  .mood-quadrant-grid { grid-template-columns: 1fr; }
}
.quadrant-canvas-wrap {
  position: relative; width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 460px;
}
.quadrant-summary { display: flex; flex-direction: column; gap: 12px; }
.quadrant-centroid {
  background: linear-gradient(135deg, rgba(219,94,18,0.07), rgba(213,107,40,0.05));
  border: 1px solid rgba(219,94,18,0.18);
  border-radius: 12px; padding: 14px 16px;
}
.quadrant-centroid-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-dim); font-weight: 700; }
.quadrant-centroid-value { font-family: 'Urbanist', sans-serif; font-size: 20px; color: var(--text); margin-top: 4px; line-height: 1.3; }
.quadrant-centroid-sub  { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.quadrant-mix {
  display: flex; flex-direction: column; gap: 8px;
}
.quadrant-mix-row {
  display: grid; grid-template-columns: 14px 1fr 36px;
  gap: 10px; align-items: center;
  font-size: 12.5px;
}
.quadrant-mix-row .swatch { width: 10px; height: 10px; border-radius: 3px; }
.quadrant-mix-row .bar-wrap { background: var(--bg-2); height: 6px; border-radius: 3px; overflow: hidden; }
.quadrant-mix-row .bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.quadrant-mix-row .pct { color: var(--text-muted); font-variant-numeric: tabular-nums; text-align: right; }
.quadrant-mix-row .label { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-stat-chip {
  background: var(--bg-elev); border: 1.5px solid var(--border); border-radius: 12px;
  padding: 14px 16px; text-align: left;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.music-stat-chip:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.msc-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-dim); font-weight: 700; margin-bottom: 4px; }
.msc-val { font-family: 'Urbanist', sans-serif; font-size: 26px; font-weight: 600; color: var(--accent); line-height: 1; }
.msc-sub { font-size: 10.5px; color: var(--text-muted); margin-top: 3px; }

/* === Recent listening card === */
.recent-listening { padding: 22px 24px; }
.recent-listening .rl-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}
@media (max-width: 560px) { .recent-listening .rl-stats { grid-template-columns: 1fr; gap: 10px; } }
.recent-listening .rl-stat { display: flex; flex-direction: column; }
.recent-listening .rl-val {
  font-family: 'Urbanist', sans-serif; font-size: 28px; font-weight: 600;
  color: var(--accent-deep); line-height: 1;
}
.recent-listening .rl-val.rl-time { font-size: 18px; color: var(--text); }
.recent-listening .rl-label {
  font-size: 11px; color: var(--text-muted); margin-top: 4px;
  text-transform: uppercase; letter-spacing: 0.10em; font-weight: 600;
}
.artist-row {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.artist-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: var(--bg-1); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.artist-chip:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.artist-chip img, .artist-chip .art-fallback {
  width: 36px; height: 36px; border-radius: 6px; flex-shrink: 0;
  object-fit: cover; background: var(--bg-2);
}
.artist-info { flex: 1; min-width: 0; }
.artist-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.artist-plays { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.track-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.track {
  display: flex; gap: 10px; align-items: center;
  padding: 10px; background: var(--bg-elev); border: 1.5px solid var(--border);
  border-radius: 12px; transition: all 0.15s ease; overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.track:hover { border-color: rgba(219,94,18,0.2); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.track .art { width: 40px; height: 40px; border-radius: 8px; background: var(--bg-2); flex-shrink: 0; object-fit: cover; }
.track .info { flex: 1; min-width: 0; }
.track .name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.track .artist { font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.spotify-disconnected { text-align: center; padding: 60px 20px; }
.spotify-disconnected svg { width: 56px; height: 56px; color: #1db954; margin-bottom: 16px; }
.spotify-disconnected h3 { font-family: 'Urbanist', sans-serif; font-size: 22px; font-weight: 500; margin-bottom: 8px; color: var(--text); }
.spotify-disconnected p { color: var(--text-muted); max-width: 460px; margin: 0 auto 22px; font-size: 13.5px; line-height: 1.6; }

/* =========================================================================
   SETTINGS VIEW
   ========================================================================= */
.settings-section {
  background: var(--bg-elev); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}
.settings-section h3 { font-family: 'Urbanist', sans-serif; font-size: 17px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.settings-section .desc { color: var(--text-muted); font-size: 13px; margin-bottom: 14px; line-height: 1.6; }
.settings-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.settings-row label { font-size: 12px; color: var(--text-muted); min-width: 90px; font-weight: 500; }
.notif-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 14px; border-radius: 10px;
  background: var(--bg-elev); border: 1px solid var(--border);
  font-size: 13px; color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}
.notif-row:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.notif-row span b { color: var(--text); font-weight: 600; }
.notif-row input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0;
}
.settings-row .input { flex: 1; min-width: 220px; }

.code-line {
  font-family: ui-monospace, monospace; font-size: 12px;
  background: var(--bg-2); color: var(--text);
  padding: 10px 12px; border-radius: 8px; border: 1.5px solid var(--border);
  word-break: break-all; user-select: all;
}

/* =========================================================================
   EMPTY STATE
   ========================================================================= */
.empty {
  text-align: center; padding: 72px 20px; color: var(--text-muted);
  background: var(--bg-elev); border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
}
.empty .icon { width: 48px; height: 48px; margin: 0 auto 16px; color: var(--text-dim); opacity: 0.8; }
.empty h3 {
  font-family: 'Urbanist', sans-serif; font-size: 22px; color: var(--text);
  font-weight: 500; margin-bottom: 8px; letter-spacing: -0.01em;
}
.empty p { font-size: 14px; max-width: 380px; margin: 0 auto; line-height: 1.55; }
.empty code {
  background: var(--bg-1); padding: 2px 8px; border-radius: 6px;
  font-size: 12.5px; color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* =========================================================================
   TOAST
   ========================================================================= */
.toast-host { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: var(--bg-elev); border: 1.5px solid var(--border);
  padding: 12px 16px; border-radius: 12px; font-size: 13px; color: var(--text);
  box-shadow: var(--shadow-lg); animation: toastIn 0.22s ease;
  pointer-events: auto; max-width: 360px; font-weight: 450;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* =========================================================================
   COMMAND PALETTE
   ========================================================================= */
.palette-backdrop {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(30,27,75,0.35); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: none; align-items: flex-start; justify-content: center;
  padding: 12vh 20px;
}
.palette-backdrop.active { display: flex; animation: fadeIn 0.15s ease; }
.palette {
  background: var(--bg-elev); border: 1.5px solid var(--border);
  border-radius: var(--radius-xl); width: 100%; max-width: 580px;
  box-shadow: var(--shadow-xl); overflow: hidden;
}
.palette-input {
  width: 100%; border: none; background: transparent;
  padding: 20px 22px; font: inherit; font-size: 15px; color: var(--text);
  border-bottom: 1.5px solid var(--border);
}
.palette-input:focus { outline: none; }
.palette-input::placeholder { color: var(--text-dim); }
.palette-list { max-height: 420px; overflow-y: auto; padding: 8px; }
.palette-item {
  padding: 10px 14px; border-radius: 10px; display: flex; align-items: center;
  gap: 10px; font-size: 13.5px; cursor: pointer; transition: background 0.1s; color: var(--text);
}
.palette-item:hover, .palette-item.active { background: rgba(219,94,18,0.07); }
.palette-item svg { width: 15px; height: 15px; color: var(--text-dim); flex-shrink: 0; }
.palette-item .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .sub { font-size: 11px; color: var(--text-dim); }
.palette-section-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700; padding: 10px 14px 4px; }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 780px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: 240px; transform: translateX(-100%); transition: transform 0.22s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }
  .content { padding: 20px 18px 80px; }
  .topbar { padding: 14px 20px; }
}
.mobile-menu-btn { display: none; }
@media (max-width: 780px) { .mobile-menu-btn { display: inline-flex; } }

/* =========================================================================
   CRISIS MODAL
   ========================================================================= */
.crisis-modal {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(24,24,27,0.45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  align-items: center; justify-content: center; padding: 20px;
}
.crisis-modal.active { display: flex; animation: fadeIn 0.3s ease; }
.crisis-inner {
  background: var(--bg-elev); border: 1.5px solid rgba(220,38,38,0.15);
  border-radius: var(--radius-xl); padding: 40px 36px; max-width: 540px; width: 100%;
  box-shadow: var(--shadow-xl), 0 0 60px rgba(220,38,38,0.06);
}
.crisis-heart {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 20px;
  background: linear-gradient(135deg, #fecdd3, #fda4af);
  display: flex; align-items: center; justify-content: center;
  animation: heartbeat 1.8s ease-in-out infinite;
}
.crisis-heart svg { width: 28px; height: 28px; color: #dc2626; }
@keyframes heartbeat {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220,38,38,0.2); }
  14% { transform: scale(1.12); box-shadow: 0 0 0 8px rgba(220,38,38,0); }
  42% { transform: scale(1.07); }
}
.crisis-inner h2 {
  font-family: 'Urbanist', sans-serif; font-size: 26px; text-align: center;
  margin-bottom: 14px; color: var(--text); font-weight: 500;
}
.crisis-message {
  font-size: 15px; line-height: 1.75; color: var(--text-muted);
  margin-bottom: 16px; text-align: center;
}
.crisis-note {
  font-size: 13.5px; line-height: 1.7; color: var(--text);
  background: rgba(219,94,18,0.04); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 22px;
  border-left: 3px solid rgba(219,94,18,0.3);
}
.crisis-resources {
  background: rgba(220,38,38,0.04); border-radius: var(--radius);
  padding: 18px; margin-bottom: 18px; border: 1.5px solid rgba(220,38,38,0.12);
}
.crisis-resource-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-muted); margin-bottom: 12px; font-weight: 700;
}
a.crisis-number {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px; background: var(--bg-elev);
  border: 1.5px solid rgba(220,38,38,0.15); border-radius: var(--radius-sm);
  margin-bottom: 8px; color: #dc2626; text-decoration: none;
  font-size: 14px; font-weight: 500; transition: all 0.15s;
  box-shadow: var(--shadow-xs);
}
a.crisis-number:last-child { margin-bottom: 0; }
a.crisis-number:hover { background: rgba(220,38,38,0.04); border-color: rgba(220,38,38,0.3); box-shadow: var(--shadow-sm); }
a.crisis-number svg { flex-shrink: 0; color: #dc2626; opacity: 0.7; }
.crisis-footer {
  font-size: 13px; color: var(--text-muted); text-align: center;
  margin-bottom: 20px; line-height: 1.7;
}

