/* ============ Momentum design system ============ */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f1f6;
  --border: #e4e6ef;
  --text: #16181d;
  --text-2: #5c6270;
  --text-3: #9aa0ad;
  --accent: #6c5ce7;
  --accent-soft: rgba(108, 92, 231, 0.12);
  --accent-contrast: #ffffff;
  --green: #00b894;
  --green-soft: rgba(0, 184, 148, 0.12);
  --red: #e17055;
  --red-soft: rgba(225, 112, 85, 0.14);
  --amber: #fdcb6e;
  --amber-soft: rgba(253, 203, 110, 0.2);
  --blue: #0984e3;
  --shadow: 0 1px 3px rgba(20, 22, 40, 0.06), 0 8px 24px rgba(20, 22, 40, 0.05);
  --shadow-lg: 0 12px 48px rgba(20, 22, 40, 0.18);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 248px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, sans-serif;
}
[data-theme="dark"] {
  --bg: #101116;
  --surface: #191b22;
  --surface-2: #21242e;
  --border: #2b2f3a;
  --text: #eef0f5;
  --text-2: #a6acba;
  --text-3: #676e7d;
  --accent: #8b7cf7;
  --accent-soft: rgba(139, 124, 247, 0.16);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: var(--text); }
kbd {
  font-family: inherit; font-size: 11px; padding: 2px 6px; border-radius: 5px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3);
}

/* ============ Splash / launch screen ============ */
#splash {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #6c5ce7, #a55eea);
  display: flex; align-items: center; justify-content: center;
  animation: splashOut 0.5s ease 1s forwards;
}
.splash-inner {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  animation: splashPulse 1.1s ease-in-out infinite;
}
.splash-bolt { width: 88px; height: 88px; filter: drop-shadow(0 6px 18px rgba(0,0,0,0.18)); }
.splash-name {
  color: #fff; font-weight: 800; font-size: 27px; letter-spacing: -0.5px;
  font-family: var(--font);
}
@keyframes splashPulse {
  0%, 100% { transform: scale(1); opacity: 0.92; }
  50% { transform: scale(1.07); opacity: 1; }
}
@keyframes splashOut {
  to { opacity: 0; visibility: hidden; pointer-events: none; }
}
@media (prefers-reduced-motion: reduce) {
  .splash-inner { animation: none; }
}

#app { display: flex; height: 100vh; overflow: hidden; }

/* ============ Sidebar ============ */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  padding: 18px 14px; gap: 6px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 16px; }
.brand-logo { font-size: 22px; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.3px; }
.brand-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px; padding: 2px 7px;
  border-radius: 20px; background: var(--surface-2); color: var(--text-2);
}
.brand-badge.pro { background: linear-gradient(135deg, #6c5ce7, #a55eea); color: #fff; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px;
  border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500;
  text-align: left; transition: background 0.15s, color 0.15s; width: 100%;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-icon { width: 18px; text-align: center; font-size: 15px; }
.nav-count { margin-left: auto; font-size: 11.5px; color: var(--text-3); font-weight: 600; }

.sidebar-section { margin-top: 14px; flex: 1; }
.sidebar-heading {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--text-3); padding: 0 12px 6px;
}
.project-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px; width: 100%;
  border-radius: var(--radius-sm); color: var(--text-2); text-align: left; font-weight: 500;
}
.project-item:hover { background: var(--surface-2); }
.project-item.active { background: var(--accent-soft); color: var(--accent); }
.project-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.project-count { margin-left: auto; font-size: 11.5px; color: var(--text-3); }

.sidebar-footer { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.level-card { padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.level-row { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.level-row .xp { color: var(--text-3); font-weight: 500; }
.xp-bar { height: 5px; background: var(--border); border-radius: 4px; overflow: hidden; }
.xp-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #a55eea); border-radius: 4px; transition: width 0.4s; }
.upgrade-btn {
  padding: 10px; border-radius: var(--radius-sm); font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #6c5ce7, #a55eea); transition: opacity 0.15s, transform 0.1s;
}
.upgrade-btn:hover { opacity: 0.92; }
.upgrade-btn:active { transform: scale(0.98); }

/* ============ Main / topbar ============ */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 26px;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
#menuBtn { display: none; }
.search-trigger {
  flex: 1; max-width: 440px; display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; color: var(--text-3); transition: border-color 0.15s;
}
.search-trigger:hover { border-color: var(--accent); }
.search-placeholder { flex: 1; font-size: 13.5px; }
.topbar-actions { display: flex; gap: 9px; margin-left: auto; align-items: center; }

.btn {
  padding: 8px 16px; border-radius: 10px; font-weight: 600; font-size: 13.5px;
  transition: opacity 0.15s, transform 0.1s, background 0.15s; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: var(--accent-contrast); }
.btn.primary:hover { opacity: 0.9; }
.btn.ghost { background: var(--accent-soft); color: var(--accent); }
.btn.ghost:hover { opacity: 0.85; }
.btn.subtle { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.btn.subtle:hover { color: var(--text); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.icon-btn {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; color: var(--text-2); font-size: 16px; transition: background 0.15s;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 22px; height: 22px; font-size: 14px; border-radius: 6px; }

.view-container { flex: 1; overflow-y: auto; padding: 26px; }
.view { max-width: 1080px; margin: 0 auto; animation: fadeUp 0.25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.view-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.view-title { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.view-sub { color: var(--text-2); font-size: 13.5px; margin-top: 2px; }

/* ============ Cards & grids ============ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.card-title { font-weight: 700; font-size: 14px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.card-title .link { font-size: 12.5px; color: var(--accent); font-weight: 600; cursor: pointer; }
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.dash-main { grid-template-columns: 1.6fr 1fr; align-items: start; }
@media (max-width: 980px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3, .grid.dash-main { grid-template-columns: 1fr; }
}

.stat-card { display: flex; flex-direction: column; gap: 3px; }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.6px; }
.stat-value { font-size: 26px; font-weight: 750; letter-spacing: -0.7px; }
.stat-hint { font-size: 12px; color: var(--text-2); }
.stat-hint.up { color: var(--green); }

/* ============ Tasks ============ */
.task-list { display: flex; flex-direction: column; gap: 7px; }
.task-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
  transition: border-color 0.15s, opacity 0.2s; cursor: pointer;
}
.task-item:hover { border-color: var(--accent); }
.task-item.done { opacity: 0.55; }
.task-item.done .task-title { text-decoration: line-through; }
.task-check {
  width: 20px; height: 20px; border-radius: 7px; border: 2px solid var(--text-3);
  flex-shrink: 0; margin-top: 1px; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: transparent; transition: all 0.15s;
}
.task-check:hover { border-color: var(--accent); }
.task-check.checked { background: var(--green); border-color: var(--green); color: #fff; }
.task-check.p-high { border-color: var(--red); }
.task-check.p-med { border-color: var(--amber); }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 14px; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; align-items: center; }
.chip {
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
  background: var(--surface-2); color: var(--text-2); display: inline-flex; align-items: center; gap: 4px;
}
.chip.overdue { background: var(--red-soft); color: var(--red); }
.chip.today { background: var(--accent-soft); color: var(--accent); }
.chip.prio-high { background: var(--red-soft); color: var(--red); }
.chip.prio-medium { background: var(--amber-soft); color: #b8860b; }
[data-theme="dark"] .chip.prio-medium { color: var(--amber); }
.chip.prio-low { background: var(--green-soft); color: var(--green); }
.chip .pdot { width: 7px; height: 7px; border-radius: 50%; }
.task-sub-progress { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.task-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.task-item:hover .task-actions { opacity: 1; }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-pill {
  padding: 6px 13px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
}
.filter-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.section-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-3); margin: 18px 0 8px; }
.section-label:first-child { margin-top: 0; }

.empty-state { text-align: center; padding: 44px 20px; color: var(--text-3); }
.empty-state .big { font-size: 34px; margin-bottom: 8px; }

/* ============ Subtasks ============ */
.subtask-row { display: flex; align-items: center; gap: 9px; padding: 6px 0; }
.subtask-row .task-check { width: 16px; height: 16px; border-radius: 5px; font-size: 10px; }
.subtask-row input[type="text"] { flex: 1; background: none; border: none; outline: none; }
.subtask-row.done span { text-decoration: line-through; color: var(--text-3); }

/* ============ Calendar ============ */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; padding: 4px 0; }
.cal-day {
  min-height: 96px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 7px; cursor: pointer; transition: border-color 0.15s;
  display: flex; flex-direction: column; gap: 4px; overflow: hidden;
}
.cal-day:hover { border-color: var(--accent); }
.cal-day.other { opacity: 0.4; }
.cal-day.today { border-color: var(--accent); background: var(--accent-soft); }
.cal-day-num { font-size: 12px; font-weight: 700; color: var(--text-2); }
.cal-day.today .cal-day-num { color: var(--accent); }
.cal-event {
  font-size: 10.5px; font-weight: 600; padding: 2px 6px; border-radius: 5px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.cal-event.done { text-decoration: line-through; opacity: 0.6; }
.cal-more { font-size: 10px; color: var(--text-3); font-weight: 600; }

/* ============ Focus / Pomodoro ============ */
.focus-wrap { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 20px 0; }
.timer-ring { position: relative; width: 260px; height: 260px; }
.timer-ring svg { transform: rotate(-90deg); }
.timer-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
}
.timer-time { font-size: 48px; font-weight: 750; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.timer-phase { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.4px; color: var(--text-3); }
.timer-phase.focus { color: var(--accent); }
.timer-phase.break { color: var(--green); }
.preset-row { display: flex; gap: 8px; }
.timer-controls { display: flex; gap: 10px; }

/* ============ Habits ============ */
.habit-card { display: flex; flex-direction: column; gap: 12px; }
.habit-top { display: flex; align-items: center; gap: 12px; }
.habit-emoji { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 21px; }
.habit-name { font-weight: 700; }
.habit-streak { font-size: 12px; color: var(--text-2); }
.habit-week { display: flex; gap: 6px; }
.habit-day {
  flex: 1; aspect-ratio: 1; max-width: 40px; border-radius: 9px; background: var(--surface-2);
  border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center;
  justify-content: center; cursor: pointer; font-size: 10px; font-weight: 700; color: var(--text-3);
  transition: all 0.15s; gap: 1px;
}
.habit-day:hover { border-color: var(--accent); }
.habit-day.checked { background: var(--green); border-color: var(--green); color: #fff; }
.habit-day.future { opacity: 0.35; pointer-events: none; }
.heatmap { display: grid; grid-template-columns: repeat(13, 1fr); gap: 3px; }
.heat-cell { aspect-ratio: 1; border-radius: 3px; background: var(--surface-2); }
.heat-cell.l1 { background: color-mix(in srgb, var(--green) 35%, var(--surface-2)); }
.heat-cell.l2 { background: color-mix(in srgb, var(--green) 65%, var(--surface-2)); }
.heat-cell.l3 { background: var(--green); }

/* ============ Notes ============ */
.notes-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .notes-layout { grid-template-columns: 1fr; } }
.note-list-item {
  padding: 12px 14px; border-radius: 10px; cursor: pointer; border: 1px solid transparent;
}
.note-list-item:hover { background: var(--surface-2); }
.note-list-item.active { background: var(--accent-soft); border-color: var(--accent); }
.note-list-title { font-weight: 650; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-list-preview { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.note-editor textarea {
  width: 100%; min-height: 380px; border: none; outline: none; background: none;
  resize: vertical; font-size: 14.5px; line-height: 1.7;
}
.note-title-input {
  width: 100%; border: none; outline: none; background: none; font-size: 21px;
  font-weight: 750; margin-bottom: 10px; letter-spacing: -0.4px;
}
.md-preview { line-height: 1.7; }
.md-preview h1, .md-preview h2, .md-preview h3 { margin: 14px 0 6px; letter-spacing: -0.3px; }
.md-preview ul { padding-left: 22px; margin: 6px 0; }
.md-preview code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: 13px; }
.md-preview blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--text-2); margin: 8px 0; }

/* ============ Goals ============ */
.goal-card { display: flex; flex-direction: column; gap: 12px; }
.goal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.goal-title { font-weight: 700; font-size: 16px; }
.progress-track { height: 8px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), #a55eea); transition: width 0.4s; }
.milestone-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; cursor: pointer; }
.milestone-row.done span { text-decoration: line-through; color: var(--text-3); }

/* ============ Analytics ============ */
.chart-box { width: 100%; }
.chart-box svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend .dot { width: 8px; height: 8px; border-radius: 50%; }
.premium-lock { position: relative; }
.premium-lock .locked-content { filter: blur(5px); pointer-events: none; user-select: none; }
.premium-lock .lock-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; text-align: center; padding: 20px;
}

/* ============ Modals ============ */
.modal-root:empty, .toast-root:empty { display: none; }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 10, 20, 0.5); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 7vh 18px 18px;
  animation: fadeIn 0.15s ease; backdrop-filter: blur(3px); overflow-y: auto;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px; padding: 22px; animation: popIn 0.18s ease;
  border: 1px solid var(--border);
}
.modal.wide { max-width: 680px; }
@keyframes popIn { from { opacity: 0; transform: scale(0.97) translateY(8px); } }
.modal-title { font-size: 18px; font-weight: 750; margin-bottom: 16px; letter-spacing: -0.3px; display: flex; justify-content: space-between; align-items: center; }
.form-row { margin-bottom: 13px; }
.form-label { display: block; font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-2); outline: none; transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.modal-actions .spacer { margin-right: auto; }

/* Search overlay */
.search-modal { max-width: 560px; padding: 0; overflow: hidden; }
.search-input-row { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.search-input-row input { flex: 1; border: none; background: none; outline: none; font-size: 16px; }
.search-results { max-height: 380px; overflow-y: auto; padding: 8px; }
.search-result { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px; cursor: pointer; }
.search-result:hover { background: var(--surface-2); }
.search-result .sr-type { font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--text-3); margin-left: auto; flex-shrink: 0; }

/* Pricing */
.pricing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px; }
@media (max-width: 640px) { .pricing-grid { grid-template-columns: 1fr; } }
.price-card { border: 1.5px solid var(--border); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.price-card.featured { border-color: var(--accent); background: var(--accent-soft); position: relative; }
.price-tag { font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.price-tag small { font-size: 13px; font-weight: 600; color: var(--text-2); }
.price-feature { font-size: 13px; color: var(--text-2); display: flex; gap: 8px; }
.price-feature::before { content: "✓"; color: var(--green); font-weight: 700; }
.badge-popular {
  position: absolute; top: -10px; right: 14px; background: var(--accent); color: #fff;
  font-size: 10.5px; font-weight: 700; padding: 3px 10px; border-radius: 12px;
}

/* AI drawer */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(10, 10, 20, 0.35); z-index: 90;
  display: none; justify-content: flex-end;
}
.drawer-overlay.open { display: flex; animation: fadeIn 0.15s; }
.drawer {
  width: 420px; max-width: 92vw; background: var(--surface); height: 100%;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease; border-left: 1px solid var(--border);
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
.drawer-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-title { font-weight: 750; font-size: 16px; }
.drawer-sub { font-size: 12px; color: var(--text-3); }
.ai-messages { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.ai-msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; }
.ai-msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.bot { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.ai-msg.bot .ai-task-suggest { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.ai-suggest-item {
  display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border); padding: 7px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
}
.ai-input-row { display: flex; gap: 9px; padding: 14px 18px; border-top: 1px solid var(--border); }
.ai-input-row textarea {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; background: var(--surface-2); outline: none;
}
.ai-quota { padding: 0 20px 12px; font-size: 11.5px; color: var(--text-3); text-align: center; }
.ai-quota .link { color: var(--accent); cursor: pointer; font-weight: 600; }

/* Toasts */
.toast-root { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  border-radius: 12px; padding: 12px 16px; min-width: 240px; max-width: 340px;
  display: flex; gap: 10px; align-items: center; animation: toastIn 0.25s ease; font-size: 13.5px;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
.toast.leaving { opacity: 0; transition: opacity 0.3s; }
.toast .t-icon { font-size: 18px; }
.toast .t-title { font-weight: 700; font-size: 13px; }
.toast .t-body { color: var(--text-2); font-size: 12.5px; }

/* Onboarding */
.onboard-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.onboard-opt {
  border: 1.5px solid var(--border); border-radius: 12px; padding: 14px 10px; text-align: center;
  cursor: pointer; transition: all 0.15s; display: flex; flex-direction: column; gap: 4px; align-items: center;
}
.onboard-opt:hover { border-color: var(--accent); }
.onboard-opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.onboard-opt .o-emoji { font-size: 24px; }
.onboard-opt .o-label { font-weight: 700; font-size: 13px; }
.onboard-opt .o-sub { font-size: 11px; color: var(--text-3); }

/* Settings */
.settings-row {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-label { font-weight: 650; }
.settings-sub { font-size: 12.5px; color: var(--text-3); }
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; cursor: pointer; z-index: 1; margin: 0; }
.switch .track { position: absolute; inset: 0; background: var(--border); border-radius: 20px; transition: background 0.2s; }
.switch .track::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* Achievements */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ach-card { text-align: center; padding: 14px 8px; border: 1px solid var(--border); border-radius: 12px; }
.ach-card.locked { opacity: 0.38; filter: grayscale(1); }
.ach-emoji { font-size: 26px; }
.ach-name { font-weight: 700; font-size: 12.5px; margin-top: 5px; }
.ach-desc { font-size: 11px; color: var(--text-3); }

/* Responsive */
@media (max-width: 820px) {
  .sidebar { position: fixed; z-index: 80; height: 100%; transform: translateX(-100%); transition: transform 0.22s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  #menuBtn { display: inline-flex; }
  .view-container { padding: 16px; }
  .search-trigger kbd { display: none; }
  #aiBtn { display: none; }
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }
