/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface2: #f9fafb;
  --border: #e5e7eb;
  --text: #111827;
  --text2: #6b7280;
  --accent: #5b5af6;
  --accent2: #7c7bf7;
  --accent-bg: rgba(91,90,246,0.08);
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --sidebar-w: 230px;
  --header-h: 60px;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.05);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
}

body.dark {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #21253a;
  --border: #2a2f45;
  --text: #f1f5f9;
  --text2: #94a3b8;
  --accent: #7b7cf8;
  --accent2: #9b9cf9;
  --accent-bg: rgba(123,124,248,0.12);
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.35);
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  transition: background 0.3s, color 0.3s;
}

svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: transform 0.3s ease, background 0.3s;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding: 0 0.5rem;
}

.brand-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'DM Serif Display', serif;
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  transition: all 0.2s ease;
  width: 100%;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item:hover {
  background: var(--accent-bg);
  color: var(--accent);
}

.nav-item.active {
  background: var(--accent);
  color: #fff;
}

.nav-item.active svg { stroke: #fff; }

.sidebar-bottom {
  padding: 0.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.theme-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text2);
  margin-bottom: 0.75rem;
}

.toggle-pill { position: relative; display: inline-block; width: 38px; height: 20px; }
.toggle-pill input { opacity: 0; width: 0; height: 0; }
.pill-track {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: 0.3s;
}
.pill-track::before {
  content: ""; position: absolute;
  width: 14px; height: 14px;
  left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%;
  transition: 0.3s;
}
input:checked + .pill-track { background: var(--accent); }
input:checked + .pill-track::before { transform: translateX(18px); }

.sidebar-datetime {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  margin-top: 0.5rem;
}
.sidebar-date {
  font-size: 0.75rem;
  color: var(--text2);
  text-align: center;
  margin-top: 0.2rem;
}

/* ===== MAIN WRAPPER ===== */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== TOPBAR ===== */
.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background 0.3s;
}

.menu-toggle {
  display: none;
  flex-direction: column; gap: 4px;
  background: none; border: none;
  padding: 4px;
}
.menu-toggle span {
  display: block; width: 20px; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: 0.3s;
}

.topbar-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text2);
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.streak-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  background: rgba(245,158,11,0.1);
  color: var(--warning);
  border-radius: 999px;
}

.task-stats-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 999px;
}

.focus-btn {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  transition: all 0.2s;
}

.focus-btn:hover { opacity: 0.85; transform: translateY(-1px); }

/* ===== VIEW CONTAINER ===== */
.view-container { flex: 1; overflow-y: auto; }

.view { display: none; padding: 1.5rem 2rem; animation: fadeUp 0.4s ease; }
.view.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.page-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.8rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.page-sub { font-size: 0.9rem; color: var(--text2); }

/* ===== KPI GRID ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.kpi-card.accent { background: var(--accent); border-color: transparent; }
.kpi-card.accent .kpi-label { color: rgba(255,255,255,0.75); }
.kpi-card.accent .kpi-value { color: #fff; }

.kpi-icon { font-size: 1.5rem; }
.kpi-value { font-size: 1.7rem; font-weight: 700; color: var(--text); line-height: 1; }
.kpi-label { font-size: 0.78rem; color: var(--text2); margin-top: 0.2rem; }

/* ===== CHARTS ===== */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.chart-card.wide { grid-column: span 1; }

/* Responsive: make 3-col layouts work */
.charts-row .wide { flex: 2; }

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.chart-header h3 { font-size: 0.95rem; font-weight: 600; }

.chart-badge {
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 999px;
  font-weight: 500;
}

.link-btn { background: none; border: none; color: var(--accent); font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* Donut legend */
.donut-legend { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; justify-content: center; }
.donut-legend span { font-size: 0.78rem; display: flex; align-items: center; gap: 0.3rem; }
.donut-legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* Heatmap */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(84, 1fr);
  gap: 2px;
  width: 100%;
  overflow: hidden;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--border);
  transition: transform 0.15s;
}
.heatmap-cell:hover { transform: scale(1.6); }
.heatmap-cell.l1 { background: rgba(91,90,246,0.2); }
.heatmap-cell.l2 { background: rgba(91,90,246,0.45); }
.heatmap-cell.l3 { background: rgba(91,90,246,0.7); }
.heatmap-cell.l4 { background: var(--accent); }

/* Recent tasks list on dashboard */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.recent-task-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.recent-task-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 0.88rem;
}
.recent-task-item .task-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.recent-task-item.done span { text-decoration: line-through; opacity: 0.5; }
.priority-dot-high { background: var(--danger); }
.priority-dot-medium { background: var(--warning); }
.priority-dot-low { background: var(--success); }
.recent-task-cat { margin-left: auto; font-size: 0.72rem; color: var(--text2); padding: 0.15rem 0.5rem; background: var(--border); border-radius: 999px; }

/* ===== TZ TOGGLE ===== */
.tz-toggle { display: flex; gap: 0.4rem; }
.tz-btn {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}
.tz-btn.active { background: var(--accent); color: #fff; }

/* ===== TASK VIEW ===== */
.task-layout { display: grid; grid-template-columns: 1fr 280px; gap: 1.25rem; }
.task-main-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }

.task-input-row {
  display: flex; gap: 0.6rem; margin-bottom: 1rem;
}

#task-input {
  flex: 1;
  padding: 0.65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

#task-input:focus { outline: none; border-color: var(--accent); }

#task-priority, #task-category {
  padding: 0.65rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
}

#add-task {
  padding: 0.65rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
}
#add-task:hover { opacity: 0.85; transform: translateY(-1px); }

.task-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem; gap: 0.75rem;
}

.filter-pills { display: flex; gap: 0.35rem; }
.filter-btn {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-size: 0.8rem;
  font-weight: 500;
  transition: 0.2s;
}
.filter-btn.active, .filter-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.search-box input {
  padding: 0.3rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface2);
  color: var(--text);
  font-size: 0.8rem;
}
.search-box input:focus { outline: none; border-color: var(--accent); }

.category-filter-row { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.cat-filter-btn {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-size: 0.75rem;
  cursor: pointer;
  transition: 0.2s;
}
.cat-filter-btn.active { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }

#task-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }

.task-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  transition: all 0.2s;
  animation: fadeUp 0.3s ease;
}

.task-item:hover { border-color: var(--accent); transform: translateX(2px); }

.task-check {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.task-check:hover { border-color: var(--accent); }
.task-check.done { background: var(--success); border-color: var(--success); }
.task-check.done::after { content: "✓"; color: #fff; font-size: 11px; }

.task-text { flex: 1; font-size: 0.9rem; }
.task-text.completed { text-decoration: line-through; opacity: 0.5; }

.task-meta { display: flex; align-items: center; gap: 0.5rem; }
.task-cat-pill { font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--accent-bg); color: var(--accent); font-weight: 500; }
.priority-badge { font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 999px; font-weight: 600; }
.priority-badge.high { background: rgba(239,68,68,0.1); color: var(--danger); }
.priority-badge.medium { background: rgba(245,158,11,0.1); color: var(--warning); }
.priority-badge.low { background: rgba(16,185,129,0.1); color: var(--success); }

.task-delete {
  background: none; border: none;
  color: var(--text2); font-size: 0.85rem;
  padding: 0.2rem 0.4rem; border-radius: 5px;
  opacity: 0; transition: all 0.2s;
}
.task-item:hover .task-delete { opacity: 1; }
.task-delete:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

.empty-state { text-align: center; padding: 2rem; color: var(--text2); font-size: 0.9rem; }

.export-btn {
  padding: 0.5rem 1rem;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  transition: 0.2s;
}
.export-btn:hover { background: var(--accent); color: #fff; }

/* TASK SIDEBAR PANEL */
.task-sidebar-panel { display: flex; flex-direction: column; gap: 1rem; }
.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.panel-card h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 1rem; }

/* Progress ring */
.progress-ring-wrap { position: relative; width: 100px; height: 100px; margin: 0 auto; }
.progress-ring { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 8; }
.ring-fill { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.ring-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }

/* Priority bars */
.priority-bars { display: flex; flex-direction: column; gap: 0.6rem; }
.pbar-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; }
.pbar-label { width: 55px; color: var(--text2); }
.pbar-track { flex: 1; height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.pbar-fill { height: 100%; border-radius: 999px; transition: width 0.6s ease; }
.pbar-count { width: 20px; text-align: right; font-weight: 600; font-size: 0.78rem; }

/* ===== POMODORO VIEW ===== */
.pomodoro-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.5rem; }

.timer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.timer-mode-tabs { display: flex; gap: 0.5rem; }
.mode-tab {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-size: 0.85rem;
  font-weight: 500;
  transition: 0.2s;
}
.mode-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.timer-ring-wrap {
  position: relative;
  width: 220px; height: 220px;
}
.timer-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-track { fill: none; stroke: var(--border); stroke-width: 8; }
.timer-progress { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.timer-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.timer-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}
.timer-mode-label { font-size: 0.8rem; color: var(--text2); margin-top: 0.4rem; font-weight: 500; }

.timer-actions { display: flex; gap: 0.75rem; align-items: center; }
.timer-btn {
  padding: 0.65rem 1.5rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  transition: all 0.2s;
}
.timer-btn.primary { background: var(--accent); color: #fff; }
.timer-btn.primary:hover { opacity: 0.85; transform: translateY(-1px); }
.timer-btn.secondary { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.timer-btn.secondary:hover { color: var(--text); border-color: var(--text2); }

.timer-settings { width: 100%; display: flex; flex-direction: column; gap: 0.75rem; padding: 0 0.5rem; }
.setting-row { display: flex; align-items: center; gap: 1rem; }
.setting-row label { font-size: 0.82rem; color: var(--text2); width: 130px; flex-shrink: 0; font-weight: 500; }
.setting-val { color: var(--accent); font-weight: 600; }
.setting-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
  cursor: pointer;
}

.pomodoro-right { display: flex; flex-direction: column; gap: 1rem; }

.session-card {}
.session-bubbles { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.session-bubble {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
}
.session-bubble.done { background: var(--accent); }
.session-bubble.break { background: var(--success); }
.session-summary { font-size: 0.82rem; color: var(--text2); }
.session-summary span { font-weight: 700; color: var(--text); }

.quote-block { }
.quote-text { font-family: 'DM Serif Display', serif; font-style: italic; font-size: 0.95rem; color: var(--text); line-height: 1.5; margin-bottom: 0.4rem; }
.quote-author { font-size: 0.78rem; color: var(--text2); margin-bottom: 0.75rem; }

/* ===== NOTES VIEW ===== */
.notes-layout { display: grid; grid-template-columns: 260px 1fr; gap: 1.25rem; }

.notes-sidebar-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  height: calc(100vh - 180px);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.notes-search input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: 0.85rem;
}
.notes-search input:focus { outline: none; border-color: var(--accent); }

.note-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.4rem; }

.note-list-item {
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
  border: 1px solid transparent;
}
.note-list-item:hover { background: var(--surface2); }
.note-list-item.active { background: var(--accent-bg); border-color: var(--accent); }
.note-list-title { font-size: 0.88rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-list-preview { font-size: 0.75rem; color: var(--text2); margin-top: 0.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-list-date { font-size: 0.7rem; color: var(--text2); margin-top: 0.2rem; }

.note-editor-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: calc(100vh - 180px);
}

#note-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.5rem;
  border: none;
  background: transparent;
  color: var(--text);
  width: 100%;
  outline: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid var(--border);
}
#note-title::placeholder { color: var(--border); }

.note-toolbar { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.fmt-btn {
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface2);
  color: var(--text2);
  font-size: 0.78rem;
  cursor: pointer;
  transition: 0.2s;
}
.fmt-btn:hover { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }

.note-body {
  flex: 1;
  outline: none;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  overflow-y: auto;
}
.note-body[data-placeholder]:empty::before { content: attr(data-placeholder); opacity: 0.4; pointer-events: none; }

.note-footer {
  display: flex; justify-content: space-between;
  font-size: 0.75rem; color: var(--text2);
  padding-top: 0.5rem; border-top: 1px solid var(--border);
}

.notes-actions { display: flex; gap: 0.5rem; }
.add-note-btn, .toggle-preview-btn {
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: 0.2s;
}
.add-note-btn { background: var(--accent); color: #fff; border: none; }
.add-note-btn:hover { opacity: 0.85; }
.toggle-preview-btn { border: 1.5px solid var(--border); background: transparent; color: var(--text2); }
.toggle-preview-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ===== ANALYTICS VIEW ===== */
.analytics-kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.analytics-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.analytics-kpi:hover { transform: translateY(-2px); }
.analytics-kpi.accent { border-color: var(--accent); }
.akpi-val { font-size: 2rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--text); }
.analytics-kpi.accent .akpi-val { color: var(--accent); }
.akpi-lab { font-size: 0.78rem; color: var(--text2); margin-top: 0.25rem; }

/* ===== MODAL ===== */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
  backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.3s ease;
  width: 300px;
}
.modal-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.modal-content p { font-size: 0.95rem; color: var(--text2); margin-bottom: 1.25rem; }
.modal-buttons { display: flex; gap: 0.75rem; justify-content: center; }
.modal-btn {
  padding: 0.55rem 1.25rem;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  font-size: 0.88rem;
  transition: 0.2s;
}
.modal-btn.cancel { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.modal-btn.danger { background: var(--danger); color: #fff; }
.modal-btn:hover { opacity: 0.85; }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  background: var(--text);
  color: var(--surface);
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 1000;
  animation: fadeUp 0.3s ease;
  box-shadow: var(--shadow-lg);
}
.toast.hidden { display: none; }

/* ===== FOCUS MODE ===== */
body.focus .sidebar,
body.focus .topbar { display: none; }
body.focus .main-wrapper { margin-left: 0; }
body.focus .view-container { padding: 1rem; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text2); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .analytics-kpi-row { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .menu-toggle { display: flex; }
  .charts-row { grid-template-columns: 1fr; }
  .task-layout { grid-template-columns: 1fr; }
  .pomodoro-layout { grid-template-columns: 1fr; }
  .notes-layout { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .view { padding: 1rem; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .analytics-kpi-row { grid-template-columns: 1fr 1fr; }
  .topbar-right { gap: 0.4rem; }
  .streak-badge, .task-stats-badge { display: none; }
  .task-input-row { flex-wrap: wrap; }
}