/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, input, select, textarea { font-family: inherit; }

:root {
  /* Rose / Beige palette */
  --bg: #EDE4DA;
  --bg-app: #FAF5F0;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FAF5F0;
  --bg-hover: rgba(0,0,0,0.03);
  --bg-input: #FDFCFA;
  --border: #E0D5C8;
  --border-light: #EDE4DA;

  --text: #2C2019;
  --text-secondary: #7A6B5D;
  --text-muted: #A89888;
  --text-inverse: #FDFCFA;

  --accent: #C4636A;
  --accent-hover: #B3565D;
  --accent-light: #FAEAEB;
  --accent-bg: #FDF5F5;

  --sage: #6B8F71;
  --sage-light: #EDF3EE;
  --sage-bg: #F5FAF6;

  --amber: #D4930D;
  --amber-light: #FEF7E6;

  --rose: #C4636A;
  --rose-light: #FAEAEB;

  --purple: #8B6DB5;
  --purple-light: #F3EEF9;

  --blue: #5B8BA5;
  --blue-light: #EBF3F7;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-shell: 20px;
  --shadow: 0 1px 3px rgba(44,32,25,0.06), 0 1px 2px rgba(44,32,25,0.04);
  --shadow-md: 0 4px 12px rgba(44,32,25,0.08), 0 2px 4px rgba(44,32,25,0.04);
  --shadow-lg: 0 12px 32px rgba(44,32,25,0.12), 0 4px 8px rgba(44,32,25,0.06);
  --shadow-shell: 0 8px 40px rgba(44,32,25,0.10), 0 2px 8px rgba(44,32,25,0.05);

  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Lora', Georgia, serif;

  --sidebar-w: 150px;
  --transition: 180ms ease;
}

html { font-size: 15px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  display: flex;
  align-items: center;
  justify-content: center;
}

h1, h2, h3 { font-family: var(--font-heading); font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.3rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 0.95rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* ===== APP SHELL — rounded notebook ===== */
.app-shell {
  width: 100vw;
  height: 100vh;
  max-width: 1400px;
  max-height: 900px;
  background: var(--bg-app);
  border-radius: var(--radius-shell);
  box-shadow: var(--shadow-shell);
  overflow: hidden;
  display: flex;
}
@media (max-width: 1440px) {
  .app-shell {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
}
@media (min-width: 1441px) {
  body { padding: 20px; }
}

/* ===== AUTH SCREEN ===== */
.auth-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 2rem; width: 100%;
}
.auth-card {
  text-align: center; max-width: 400px;
}
.auth-title {
  font-family: var(--font-heading); font-size: 2rem; color: var(--text);
  margin-bottom: 0.25rem;
}
.auth-subtitle {
  color: var(--text-secondary); font-size: 1.15rem; margin-bottom: 2.5rem;
  font-style: italic;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-body); font-weight: 500; font-size: 0.85rem;
  border: none; border-radius: 6px; cursor: pointer;
  padding: 8px 16px; transition: all var(--transition);
}
.btn-primary {
  background: var(--accent); color: var(--text-inverse);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text); }
.btn-ghost {
  background: transparent; color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-lg { padding: 12px 28px; font-size: 0.95rem; }
.btn-icon {
  padding: 6px; background: transparent; color: var(--text-secondary);
  border-radius: var(--radius-sm);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }
.btn-sage { background: var(--sage); color: var(--text-inverse); }
.btn-sage:hover { background: #5D7F63; }

/* ===== LAYOUT ===== */
.app-layout {
  display: flex; width: 100%; height: 100%;
}

/* ===== SIDEBAR — slim, word-only ===== */
.sidebar {
  width: var(--sidebar-w);
  background: transparent;
  display: flex;
  flex-direction: column;
  padding: 0;
  flex-shrink: 0;
  border-right: 1px solid var(--border-light);
}

.sidebar-header {
  padding: 20px 24px 0;
}
.sidebar-logo {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}
.sidebar-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}

.nav-list {
  list-style: none;
  padding: 0 24px;
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: block;
  padding: 8px 0;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all var(--transition);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.nav-link:hover {
  color: var(--text);
  text-decoration: none;
}
.nav-link.active {
  color: var(--accent);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-footer-actions {
  display: flex; align-items: center; gap: 6px;
  padding: 0;
}
.sidebar-settings-btn {
  padding: 6px; color: var(--text-muted); border-radius: 4px;
  transition: all 150ms ease; display: flex; align-items: center;
  text-decoration: none;
}
.sidebar-settings-btn:hover { background: var(--bg-hover); color: var(--text); }

/* Context switcher */
.ctx-switcher { position: relative; }

.ctx-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 4px 0;
  background: transparent; border: none;
  cursor: pointer;
  font-family: var(--font-body); font-size: 0.82rem; text-align: left;
  transition: all 150ms ease; color: var(--text);
  overflow: visible;
}
.ctx-btn:hover { background: var(--bg-hover); }

.ctx-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: var(--text-inverse);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 600; flex-shrink: 0;
}
.ctx-btn-group .ctx-avatar { background: var(--sage); }

.ctx-label {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; line-height: 1.2;
}
.ctx-name {
  font-weight: 500; color: var(--text);
  font-size: 0.82rem;
}
.ctx-sublabel {
  font-size: 0.6rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--sage); opacity: 0.8;
}
.ctx-arrow {
  font-size: 0.72rem; color: var(--text-muted); flex-shrink: 0;
}

.ctx-menu {
  position: absolute; bottom: calc(100% + 4px); left: 0;
  min-width: 180px;
  background: var(--bg-app); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 4px; z-index: 200;
}
.ctx-menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px;
  border: none; background: transparent;
  color: var(--text-secondary); font-family: var(--font-body); font-size: 0.82rem;
  cursor: pointer; border-radius: var(--radius-sm);
  transition: background 150ms ease; text-align: left;
}
.ctx-menu-item:hover { background: var(--bg-hover); color: var(--text); }
.ctx-menu-active {
  background: var(--accent-light); color: var(--accent); font-weight: 500;
}

.ctx-avatar-sm {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--border); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 600; flex-shrink: 0;
}
.ctx-menu-active .ctx-avatar-sm { background: var(--accent); color: var(--text-inverse); }

.ctx-menu-role {
  margin-left: auto; font-size: 0.65rem;
  color: var(--text-muted); letter-spacing: 0.03em;
}
.ctx-menu-divider {
  height: 1px; background: var(--border-light); margin: 4px;
}

/* Logout button */
.sidebar-logout-btn {
  padding: 6px; background: none; border: none;
  color: var(--text-muted); cursor: pointer; border-radius: 4px;
  transition: all 150ms ease; display: flex; align-items: center;
}
.sidebar-logout-btn:hover { background: var(--bg-hover); color: var(--rose); }

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
  max-height: 100%;
  position: relative;
}

/* Universal action icons (top right, always visible) */
.universal-actions {
  position: absolute;
  top: 22px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 20;
}

/* ===== VIEW HEADER ===== */
.view-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}
.view-header h1 { margin: 0; font-size: 1.3rem; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 4px;
  font-size: 0.7rem; font-weight: 500; letter-spacing: 0.02em;
}
.badge-active { background: var(--sage-light); color: var(--sage); }
.badge-paused { background: var(--amber-light); color: var(--amber); }
.badge-completed { background: var(--blue-light); color: var(--blue); }
.badge-not_started { background: var(--bg-hover); color: var(--text-muted); }
.badge-abandoned { background: var(--rose-light); color: var(--rose); }
.badge-archived { background: var(--bg-hover); color: var(--text-muted); }
.badge-open { background: var(--amber-light); color: var(--amber); }
.badge-in_progress { background: var(--blue-light); color: var(--blue); }
.badge-done { background: var(--sage-light); color: var(--sage); }
.badge-skipped { background: var(--bg-hover); color: var(--text-muted); }

.badge-priority-low { background: var(--bg-hover); color: var(--text-muted); }
.badge-priority-medium { background: var(--amber-light); color: var(--amber); }
.badge-priority-high { background: var(--rose-light); color: var(--rose); }
.badge-priority-urgent { background: var(--rose); color: white; }

.badge-mission { background: var(--accent-light); color: var(--accent); }
.badge-stream { background: var(--blue-light); color: var(--blue); }

/* ===== PROGRESS BAR ===== */
.progress-bar {
  height: 4px; background: var(--border-light); border-radius: 2px;
  overflow: hidden; width: 100%;
}
.progress-bar-fill {
  height: 100%; border-radius: 2px;
  background: var(--accent);
  transition: width 400ms ease;
}

/* ===== CADENCE HEALTH ===== */
.cadence-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.cadence-on_track { background: var(--sage); }
.cadence-slipping { background: var(--amber); }
.cadence-neglected { background: var(--rose); }

/* ===== MISSIONS HOME VIEW ===== */
.missions-home {
  max-width: 880px;
}

.missions-home-header {
  margin-bottom: 40px;
}
.missions-home-header h1 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.missions-home-tagline {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
}

.missions-section {
  margin-bottom: 36px;
}
.missions-section-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.missions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.mission-card {
  padding: 24px;
  background: rgba(255,255,255,0.45);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 200ms ease;
  min-height: 120px;
  display: flex;
  flex-direction: column;
}
.mission-card:hover {
  background: rgba(255,255,255,0.7);
  transform: translateY(-1px);
}

.mission-card-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
}
.mission-card-vision {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
  flex: 1;
}
.mission-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.mission-card-progress {
  width: 60px;
}

.missions-empty {
  padding: 60px 0;
  text-align: center;
}
.missions-empty-text {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.missions-empty-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Health dot on cards */
.mission-card-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.mission-card-dot-green { background: var(--sage); }
.mission-card-dot-amber { background: var(--amber); }
.mission-card-dot-rose { background: var(--rose); }
.mission-card-dot-grey { background: var(--border); }

/* Unsorted chip */
.unsorted-chip {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 24px;
  padding: 8px 16px;
  background: rgba(0,0,0,0.03);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 150ms ease;
}
.unsorted-chip:hover {
  background: rgba(0,0,0,0.05);
  border-color: var(--text-muted);
}
.unsorted-chip-label {
  font-size: 0.82rem; color: var(--text-muted);
}
.unsorted-chip-count {
  font-size: 0.7rem; color: var(--text-muted);
  background: var(--border-light);
  padding: 1px 7px; border-radius: 10px;
}

/* ===== FOCUS VIEW ===== */
.focus-view {
  max-width: 680px;
}

.focus-section {
  margin-bottom: 0;
}
.focus-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.focus-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.focus-now-title {
  color: var(--accent);
}
.focus-inline-add {
  border: none; border-bottom: 1px solid transparent;
  background: transparent;
  font-family: var(--font-body); font-size: 0.82rem;
  color: var(--text); padding: 4px 0;
  outline: none; width: 160px;
}
.focus-inline-add::placeholder { color: var(--border); }
.focus-inline-add:focus {
  border-bottom-color: var(--border-light);
  width: 300px;
}
.focus-inline-add:focus::placeholder { color: var(--text-muted); }

.focus-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0;
  transition: background 150ms ease;
  min-height: 34px;
}
.focus-row:hover {
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  padding: 7px 8px;
  margin: 0 -8px;
}
.focus-row-title {
  flex: 1; font-size: 0.88rem; font-weight: 500;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  line-height: 1.4;
}
.focus-row-title.done {
  text-decoration: line-through; color: var(--text-muted);
}
.focus-row-mission {
  font-size: 0.75rem; color: var(--text-muted);
  font-style: italic; flex-shrink: 0;
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.focus-row-meta {
  font-size: 0.72rem; color: var(--text-muted); flex-shrink: 0;
}
.focus-pull-btn {
  background: none; border: none;
  font-family: var(--font-body); font-size: 0.72rem;
  color: var(--accent); cursor: pointer;
  padding: 2px 6px; border-radius: 3px;
  opacity: 0; transition: opacity 150ms ease;
}
.focus-row:hover .focus-pull-btn { opacity: 1; }
.focus-pull-btn:hover { background: var(--accent-light); }

.focus-empty {
  padding: 4px 0 12px; color: var(--text-muted); font-size: 0.82rem;
  font-style: italic;
}

.focus-checkbox {
  width: 18px; height: 18px; border: 2px solid var(--border);
  border-radius: 50%; cursor: pointer; flex-shrink: 0;
  transition: all var(--transition); display: flex; align-items: center; justify-content: center;
}
.focus-checkbox:hover { border-color: var(--sage); }
.focus-checkbox.checked {
  background: var(--sage); border-color: var(--sage);
}
.focus-checkbox.checked::after {
  content: ''; display: block; width: 5px; height: 5px;
  background: white; border-radius: 50%;
}

/* Recurring action button */
.assignee-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent-light); color: var(--accent);
  font-size: 0.65rem; font-weight: 600;
  flex-shrink: 0;
}

.recurring-done-btn {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border); background: none;
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; color: var(--text-muted);
  transition: all 150ms ease;
}
.recurring-done-btn:hover { border-color: var(--sage); }
.recurring-done-today {
  background: var(--sage); border-color: var(--sage); color: white;
}

/* ===== MISSION DETAIL VIEW ===== */
.mission-detail {
  max-width: 100%;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 80px);
  max-height: 820px;
}

.mission-detail-back {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--text-muted); font-size: 0.75rem;
  cursor: pointer; margin-bottom: 8px;
  transition: color 150ms ease;
  background: none; border: none; font-family: var(--font-body);
  padding: 0;
}
.mission-detail-back:hover { color: var(--text); text-decoration: none; }

.mission-detail-header {
  margin-bottom: 20px;
  flex-shrink: 0;
}
.mission-detail-header h1 {
  font-size: 1.3rem;
  margin-bottom: 4px;
}
.mission-detail-vision {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 8px;
}
.mission-detail-meta {
  display: flex; align-items: center; gap: 12px;
  font-size: 0.78rem; color: var(--text-muted);
}

/* Top-right action icons */
.detail-top-actions {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.detail-action-icon {
  width: 26px; height: 26px;
  border: 1.5px dashed var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 200ms ease;
  position: relative;
  opacity: 0.6;
}
.detail-action-icon svg { width: 12px; height: 12px; }
.detail-action-icon:hover {
  border-color: var(--accent); color: var(--accent); background: var(--accent-light);
  opacity: 1;
}
.detail-action-icon.drop-active {
  border-color: var(--accent); background: var(--accent-light); color: var(--accent);
  transform: scale(1.15); opacity: 1;
}
.detail-action-icon-tooltip {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--text); color: var(--text-inverse);
  font-size: 0.68rem; padding: 3px 8px; border-radius: 4px;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 150ms ease;
}
.detail-action-icon:hover .detail-action-icon-tooltip { opacity: 1; }

/* Smart input popover */
.detail-smart-popover {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 300px; padding: 12px;
  background: var(--bg-app); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  z-index: 50;
}
.detail-smart-popover input {
  width: 100%; border: none; border-bottom: 1px solid var(--border-light);
  background: transparent; padding: 6px 0;
  font-family: var(--font-body); font-size: 0.88rem; color: var(--text);
}
.detail-smart-popover input:focus { outline: none; border-bottom-color: var(--accent); }
.detail-smart-popover input::placeholder { color: var(--text-muted); }

/* View toggle */
.detail-view-toggle {
  display: flex; gap: 2px; flex-shrink: 0;
  margin-bottom: 16px;
}
.detail-view-btn {
  padding: 5px 14px; background: none; border: none;
  font-family: var(--font-body); font-size: 0.78rem; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  border-radius: 4px; transition: all 150ms ease;
}
.detail-view-btn:hover { color: var(--text); }
.detail-view-btn.active {
  color: var(--accent); background: var(--accent-light);
}

/* Full-height side panel (fixed right) */
.detail-panel-overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,0.05);
}
.detail-panel-full {
  position: fixed;
  top: 0; right: 0;
  width: 0; height: 100vh;
  background: var(--bg-app);
  border-left: 0px solid transparent;
  overflow-y: auto;
  z-index: 45;
  transition: width 250ms ease, padding 250ms ease, border 250ms ease;
  padding: 0;
}
.detail-panel-full.open {
  width: 360px;
  padding: 28px 24px;
  border-left: 1px solid var(--border-light);
  box-shadow: -4px 0 20px rgba(0,0,0,0.06);
}

.detail-panel-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px;
  border-radius: 4px; float: right;
}
.detail-panel-close:hover { color: var(--text); background: var(--bg-hover); }

.panel-field {
  margin-bottom: 14px;
}
.panel-field-label {
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin-bottom: 5px;
}
.panel-field input, .panel-field select, .panel-field textarea {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.85rem;
  color: var(--text); background: var(--bg-input);
}
.panel-field input:focus, .panel-field select:focus, .panel-field textarea:focus {
  outline: none; border-color: var(--accent);
}
.panel-field textarea { resize: vertical; min-height: 60px; }

.panel-pill-row {
  display: flex; gap: 4px; flex-wrap: wrap;
}
.panel-pill {
  padding: 4px 10px; border: 1px solid var(--border-light);
  border-radius: 16px; background: transparent;
  font-family: var(--font-body); font-size: 0.75rem;
  color: var(--text-secondary); cursor: pointer;
  transition: all 150ms ease;
}
.panel-pill:hover { border-color: var(--border); }
.panel-pill.active {
  border-color: var(--accent); background: var(--accent-light); color: var(--accent);
}

/* ===== GOAL TIMELINE ===== */
.goal-timeline {
  margin-bottom: 24px;
  padding: 12px 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.goal-timeline-track {
  display: flex;
  align-items: flex-start;
  gap: 0;
  position: relative;
  min-width: max-content;
}
.goal-timeline-track::before {
  content: '';
  position: absolute;
  top: 9px;
  left: 20px; right: 20px;
  height: 2px;
  background: var(--border-light);
  z-index: 0;
}
.goal-timeline-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 80px;
  max-width: 140px;
  position: relative;
  z-index: 1;
}
.goal-timeline-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--border);
  border: 3px solid var(--bg-app);
  box-shadow: 0 0 0 2px var(--border-light);
  margin-bottom: 6px;
  transition: all 200ms ease;
}
.goal-timeline-node.active .goal-timeline-dot {
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
.goal-timeline-node.done .goal-timeline-dot {
  background: var(--sage);
  box-shadow: 0 0 0 2px var(--sage);
}
.goal-timeline-label {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.3;
  max-width: 110px;
}
.goal-timeline-node.done .goal-timeline-label {
  color: var(--text-muted);
  text-decoration: line-through;
}
.goal-timeline-progress {
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.goal-timeline-node {
  cursor: pointer;
}
.goal-timeline-node:hover .goal-timeline-dot {
  transform: scale(1.2);
}
.goal-timeline-node.selected .goal-timeline-dot {
  box-shadow: 0 0 0 3px var(--accent);
  background: var(--accent);
}
.goal-timeline-node.selected .goal-timeline-label {
  color: var(--text); font-weight: 700;
}

/* Timeline expand area */
.timeline-expand {
  margin-bottom: 16px;
}
.timeline-expand:empty { margin: 0; }

.timeline-goal-detail {
  padding: 14px 16px;
  background: rgba(255,255,255,0.4);
  border-radius: var(--radius-sm);
  margin-top: 4px;
}
.timeline-action-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 150ms ease;
}
.timeline-action-row:hover { background: var(--bg-hover); padding: 4px 6px; margin: 0 -6px; }

/* Completed goals toggle */
.list-done-toggle {
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.list-done-toggle:hover { color: var(--text-secondary); }

/* ===== LIST VIEW ===== */
.list-view { }

.list-goal {
  margin-bottom: 4px;
}
.list-goal-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 8px 10px 0;
  cursor: pointer; transition: background 150ms ease;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--border-light);
}
.list-goal-row:hover { background: var(--bg-hover); padding-left: 8px; }
.list-goal-row.selected { background: var(--accent-light); padding-left: 8px; }

.highlight-flash {
  animation: highlightFlash 1.5s ease;
}
@keyframes highlightFlash {
  0%, 100% { background: transparent; }
  20% { background: var(--accent-light); }
  80% { background: var(--accent-light); }
}

.list-goal-title {
  font-family: var(--font-heading); font-weight: 600;
  font-size: 0.92rem; color: var(--text); flex: 1;
}
.list-goal-title.done { text-decoration: line-through; color: var(--text-muted); }
.list-goal-count {
  font-size: 0.72rem; color: var(--text-muted); flex-shrink: 0;
}

.list-action {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px 5px 20px;
  cursor: pointer; transition: background 150ms ease;
  border-radius: var(--radius-sm);
  position: relative;
}
.list-action::before {
  content: '';
  position: absolute;
  left: 8px; top: 50%;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--border);
  transform: translateY(-50%);
}
.list-action:hover { background: var(--bg-hover); }
.list-action.selected { background: var(--accent-light); }
.list-action[draggable="true"] { cursor: grab; }
.list-action[draggable="true"]:active { cursor: grabbing; }

.list-action-title {
  flex: 1; font-size: 0.85rem; font-weight: 500;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-action-title.done { text-decoration: line-through; color: var(--text-muted); }

.list-action-meta {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}

/* Sub-goal indent */
.list-subgoal { padding-left: 16px; }
.list-subgoal .list-action { padding-left: 40px; }

/* ===== BUCKET VIEW ===== */
.bucket-view { }

.bucket-goal {
  margin-bottom: 20px;
}
.bucket-goal-header {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; cursor: pointer;
  user-select: none;
}
.bucket-goal-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 0.7rem; padding: 2px;
  transition: transform 150ms ease; display: flex;
}
.bucket-goal-toggle.collapsed { transform: rotate(-90deg); }
.bucket-goal-title {
  font-family: var(--font-heading); font-weight: 600;
  font-size: 0.92rem; color: var(--text); flex: 1;
}
.bucket-goal-title.done { text-decoration: line-through; color: var(--text-muted); }
.bucket-goal-count {
  font-size: 0.72rem; color: var(--text-muted);
}

.bucket-goal-body {
  overflow: hidden; transition: max-height 300ms ease;
}
.bucket-goal-body.collapsed { max-height: 0 !important; }

.bucket-lanes {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 8px; padding: 4px 0;
}
.bucket-lane {
  min-height: 50px; padding: 6px;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.015);
  transition: background 200ms ease;
}
.bucket-lane.drop-active {
  background: var(--accent-light);
}
.bucket-lane-label {
  font-size: 0.65rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin-bottom: 6px; padding: 0 2px;
}

.bucket-card {
  padding: 6px 8px;
  background: var(--bg-app);
  border-radius: 5px;
  margin-bottom: 4px;
  font-size: 0.82rem; font-weight: 500;
  cursor: grab; transition: all 150ms ease;
  border: 1px solid transparent;
}
.bucket-card:hover { border-color: var(--border); }
.bucket-card:active { cursor: grabbing; opacity: 0.6; }
.bucket-card.selected { border-color: var(--accent); background: var(--accent-light); }
.bucket-card.dragging { opacity: 0.3; }
.bucket-card-done { color: var(--text-muted); text-decoration: line-through; }

/* Action rows (kept for compatibility) */
.action-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; transition: all 150ms ease;
}
.action-row:hover {
  background: var(--bg-hover); border-radius: var(--radius-sm);
  padding: 7px 8px; margin: 0 -8px;
}
.action-row-title {
  flex: 1; font-size: 0.88rem; font-weight: 500;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.action-row-title.done { text-decoration: line-through; color: var(--text-muted); }
.action-row-meta { font-size: 0.72rem; color: var(--text-muted); flex-shrink: 0; }

/* Right-click context menu */
.context-menu {
  position: fixed;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 300;
  min-width: 160px;
}
.context-menu button {
  display: block; width: 100%;
  padding: 8px 12px; text-align: left;
  background: none; border: none;
  font-family: var(--font-body); font-size: 0.82rem;
  color: var(--text-secondary); cursor: pointer;
  border-radius: 4px;
}
.context-menu button:hover {
  background: var(--bg-hover); color: var(--text);
}
.context-menu-danger:hover {
  background: var(--rose-light) !important; color: var(--rose) !important;
}

/* Drop zones for drag */
.drop-zone {
  padding: 6px 12px;
  border: 2px dashed transparent;
  border-radius: var(--radius-sm);
  transition: all 200ms ease;
  min-height: 32px;
}
.drop-zone-active {
  border-color: var(--accent);
  background: var(--accent-light);
}

/* Inline add */
.inline-add-input {
  width: 100%; border: none; border-bottom: 1px solid transparent;
  background: transparent; padding: 6px 0;
  font-family: var(--font-body); font-size: 0.82rem;
  color: var(--text); outline: none;
}
.inline-add-input::placeholder { color: var(--border); }
.inline-add-input:focus { border-bottom-color: var(--border-light); }
.inline-add-input:focus::placeholder { color: var(--text-muted); }

/* ===== DREAM VIEW ===== */
.dream-type-btn {
  flex: 1; padding: 16px; text-align: left;
  background: transparent; border: 2px solid var(--border-light);
  border-radius: var(--radius); cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
}
.dream-type-btn:hover { border-color: var(--accent); }
.dream-type-btn.active {
  border-color: var(--accent); background: var(--accent-bg);
}

.dream-step {
  display: flex; gap: 16px; margin-bottom: 24px;
}
.dream-step-num {
  width: 28px; height: 28px; flex-shrink: 0;
  background: var(--accent-light); color: var(--accent);
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 0.85rem;
  margin-top: 2px;
}
.dream-step-body { flex: 1; }
.dream-input-lg {
  font-size: 1rem; padding: 12px 0;
  font-family: var(--font-body); font-weight: 500;
  border: none; border-bottom: 1px solid var(--border-light);
  background: transparent; color: var(--text); width: 100%;
}
.dream-input-lg:focus { outline: none; border-bottom-color: var(--accent); }

/* ===== CHAT PANEL ===== */
.chat-panel {
  overflow: hidden;
}
.chat-messages {
  max-height: 400px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
}
.chat-messages:empty { display: none; }
.chat-messages:not(:empty) { padding: 16px 0; }
.chat-msg {
  max-width: 85%; padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 0.9rem; line-height: 1.5;
}
.chat-msg.user {
  align-self: flex-end; background: var(--accent); color: var(--text-inverse);
  border-bottom-right-radius: 4px;
}
.chat-msg.assistant {
  align-self: flex-start; background: var(--border-light);
  border-bottom-left-radius: 4px;
}
.chat-msg.assistant p { margin-bottom: 8px; }
.chat-msg.assistant p:last-child { margin-bottom: 0; }
.chat-input-row {
  display: flex; gap: 8px; padding: 12px 0;
  border-top: 1px solid var(--border-light);
}
.chat-input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-family: var(--font-body);
  font-size: 0.9rem; background: var(--bg-input); color: var(--text);
}
.chat-input:focus { outline: none; border-color: var(--accent); }

/* JSON create blocks in chat */
.chat-create-block {
  background: var(--sage-bg); border: 1px solid var(--sage-light);
  border-radius: var(--radius-sm); padding: 10px 14px; margin: 8px 0;
}
.chat-create-block-title {
  font-weight: 600; font-size: 0.85rem; margin-bottom: 4px;
}
.chat-create-block-type {
  font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase;
}
.chat-create-btn {
  margin-top: 6px; font-size: 0.78rem; padding: 4px 10px;
}

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 0.82rem; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
}
.form-input, .form-textarea, .form-select {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.9rem;
  background: var(--bg-input); color: var(--text);
  transition: border-color var(--transition);
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none; border-color: var(--accent);
}
.form-textarea { resize: vertical; min-height: 80px; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(44,32,25,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg-app); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 90%; max-width: 620px;
  max-height: 85vh; overflow-y: auto; padding: 28px;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h2 { margin: 0; }
.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px;
}

/* ===== SETTINGS ===== */
.settings-section {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}
.settings-section:last-child { border-bottom: none; }
.settings-section-title {
  font-size: 1rem;
  margin-bottom: 12px;
}

/* ===== LANDING ANIMATION ===== */
.landing-fullscreen {
  position: fixed; inset: 0; z-index: 60;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}

.landing-close {
  position: fixed;
  top: 24px; right: 24px;
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  opacity: 0;
  animation: landingFadeIn 600ms ease 2s both;
  transition: background 150ms ease;
  z-index: 61;
}
.landing-close:hover { background: var(--bg-hover); color: var(--text); }

.landing-center {
  text-align: center; max-width: 600px; padding: 40px 20px;
}

.landing-logo {
  font-family: var(--font-heading); font-size: 2.2rem;
  font-weight: 700; color: var(--text);
  margin-bottom: 6px;
  opacity: 0;
  animation: landingWordIn 600ms ease 0.2s both;
  will-change: transform, left, top, font-size;
}

.landing-tagline {
  font-family: var(--font-body); font-size: 0.92rem;
  color: var(--text-muted); font-style: italic;
  letter-spacing: 0.02em;
  margin-bottom: 40px;
  opacity: 0;
  animation: landingWordIn 600ms ease 0.5s both;
  will-change: transform, left, top, font-size;
}

.landing-words {
  display: flex; flex-direction: column; align-items: center;
  gap: 20px;
}

.landing-word {
  display: flex; flex-direction: column; align-items: center;
  opacity: 0;
  animation: landingWordIn 700ms ease both;
  will-change: transform, left, top, width;
}

.landing-word-title {
  font-family: var(--font-heading); font-size: 1.6rem;
  font-weight: 600; color: var(--text); line-height: 1.2;
}

.landing-word-sub {
  font-size: 0.82rem; color: var(--text-muted);
  font-style: italic; margin-top: 2px;
}

@keyframes landingWordIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes landingFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes landingFadeOut { to { opacity: 0; transform: scale(1.01); } }
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-muted);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state-text { font-size: 1rem; margin-bottom: 16px; }

/* ===== LOADING ===== */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; color: var(--text-muted);
}
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 600ms linear infinite; margin-right: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

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

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar .nav-link { font-size: 0; padding: 12px; text-align: center; }
  .sidebar .nav-link::first-letter { font-size: 0.9rem; }
  .main-content { padding: 24px 20px; }
  .ctx-switcher { display: none; }
}
@media (max-width: 600px) {
  .sidebar { display: none; }
  .main-content { padding: 20px 16px; }
}
