/* =========================================================
   SmartTask AI — Design System
   ========================================================= */

:root {
  /* Light theme */
  --bg: #f6f7fb;
  --bg-soft: #eef0f9;
  --surface: rgba(255, 255, 255, 0.75);
  --surface-solid: #ffffff;
  --surface-2: rgba(255, 255, 255, 0.55);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --primary-3: #ec4899;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.12), 0 2px 6px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 20px 60px -20px rgba(99, 102, 241, 0.25), 0 8px 24px -12px rgba(15, 23, 42, 0.12);
  --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --gradient-soft: linear-gradient(135deg, rgba(99,102,241,0.10), rgba(236,72,153,0.10));
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --sidebar-w: 264px;
  --topbar-h: 72px;
  --transition: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #07080f;
  --bg-soft: #0c0e18;
  --surface: rgba(20, 22, 35, 0.65);
  --surface-solid: #13152a;
  --surface-2: rgba(28, 30, 48, 0.55);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e6e8f0;
  --text-secondary: #a4a9c2;
  --text-muted: #6b7191;
  --primary: #818cf8;
  --primary-2: #a78bfa;
  --primary-3: #f472b6;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.5), 0 2px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 60px -20px rgba(99, 102, 241, 0.45), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  --gradient: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #f472b6 100%);
  --gradient-soft: linear-gradient(135deg, rgba(129,140,248,0.14), rgba(244,114,182,0.14));
}

/* =========================================================
   Base
   ========================================================= */
* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  transition: background-color 0.4s var(--transition), color 0.3s var(--transition);
}

body {
  background:
    radial-gradient(1200px 600px at 0% 0%, rgba(99, 102, 241, 0.12), transparent 60%),
    radial-gradient(900px 600px at 100% 100%, rgba(236, 72, 153, 0.10), transparent 60%),
    var(--bg);
}

[data-theme="dark"] body {
  background:
    radial-gradient(1200px 600px at 0% 0%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(900px 600px at 100% 100%, rgba(236, 72, 153, 0.14), transparent 60%),
    var(--bg);
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); background-clip: padding-box; border: 2px solid transparent; }

/* Animated background orbs */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 20s ease-in-out infinite;
}
.orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
  top: -200px; left: -100px;
}
.orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #ec4899 0%, transparent 70%);
  top: 40%; right: -100px;
  animation-delay: -7s;
}
.orb-3 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
  bottom: -300px; left: 30%;
  animation-delay: -14s;
}
[data-theme="dark"] .orb { opacity: 0.25; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -40px) scale(1.1); }
  66% { transform: translate(-30px, 30px) scale(0.95); }
}

/* =========================================================
   App Layout
   ========================================================= */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  gap: 0;
}

/* Sidebar */
.sidebar {
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  overflow-y: auto;
  z-index: 10;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 18px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}
.logo-mark {
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--gradient);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 6px 20px -6px rgba(99, 102, 241, 0.6);
  position: relative;
  overflow: hidden;
}
.logo-mark::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 30%, rgba(255,255,255,0.3) 50%, transparent 70%);
  animation: shine 3s ease-in-out infinite;
}
@keyframes shine {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}
.logo-mark svg { width: 18px; height: 18px; position: relative; z-index: 1; }
.logo-text { display: flex; align-items: baseline; gap: 6px; }
.logo-name {
  font-size: 16px;
  color: var(--text);
  letter-spacing: -0.02em;
}
.logo-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--gradient);
  color: #fff;
  letter-spacing: 0.05em;
}

.sidebar-close { display: none; }

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 8px;
}
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 6px 12px 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.18s var(--transition);
  position: relative;
  user-select: none;
}
.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.nav-item.active {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 6px 20px -6px rgba(99, 102, 241, 0.5);
}
.nav-item.active .nav-badge { background: rgba(255,255,255,0.25); color: #fff; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item span:nth-child(2) { flex: 1; }
.nav-badge {
  background: var(--surface-2);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  min-width: 22px;
  text-align: center;
}
.nav-dot {
  width: 8px; height: 8px;
  background: var(--primary-3);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.18);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(236, 72, 153, 0); }
}
.ai-nav .ai-icon-wrap {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: var(--gradient-soft);
  border-radius: 6px;
}

.sidebar-footer { margin-top: 12px; }
.productivity-card {
  background: var(--gradient-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.productivity-card::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  background: var(--gradient);
  border-radius: 50%;
  opacity: 0.1;
  filter: blur(20px);
}
.prod-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}
.prod-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}
.prod-score {
  font-size: 20px;
  font-weight: 800;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.prod-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin: 8px 0 0;
  position: relative;
  z-index: 1;
}

/* Progress */
.progress {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.progress-bar {
  height: 100%;
  background: var(--gradient);
  border-radius: 99px;
  transition: width 0.6s var(--transition);
  position: relative;
}
.ai-progress { background: var(--gradient); }

/* Main */
.main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  z-index: 5;
  gap: 16px;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  max-width: 600px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-toggle { display: none; }

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 480px;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  height: 42px;
  padding: 0 60px 0 42px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 12px;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  transition: all 0.2s var(--transition);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--primary);
  background: var(--surface-solid);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}
.kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  font-family: 'Inter', monospace;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  color: var(--text);
  transition: all 0.18s var(--transition);
  white-space: nowrap;
  user-select: none;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 6px 18px -6px rgba(99, 102, 241, 0.55);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -8px rgba(99, 102, 241, 0.7);
}
.btn-ghost {
  background: var(--surface-2);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-solid); border-color: var(--border-strong); }
.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 6px 18px -6px rgba(239, 68, 68, 0.5);
}
.btn-danger:hover { background: #dc2626; }
.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  display: grid; place-items: center;
}

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: grid; place-items: center;
  color: var(--text-secondary);
  transition: all 0.18s var(--transition);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-solid); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* Theme toggle icons */
.icon-sun, .icon-moon { display: none; }
[data-theme="light"] .icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }

/* =========================================================
   Page
   ========================================================= */
.page {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 60px;
  animation: pageIn 0.4s var(--transition);
}
.page.active { display: block; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 4px;
  color: var(--text);
}
.page-subtitle { color: var(--text-secondary); margin: 0; font-size: 14px; }
.page-head-actions { display: flex; gap: 8px; }

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* =========================================================
   Card
   ========================================================= */
.card {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  transition: all 0.3s var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  gap: 12px;
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 2px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title .title-icon {
  width: 18px; height: 18px;
  color: var(--primary);
}
.card-subtitle { color: var(--text-muted); font-size: 12.5px; margin: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.badge-ai {
  background: var(--gradient-soft);
  color: var(--primary);
  border-color: transparent;
}
.badge-ai svg { width: 11px; height: 11px; }

/* =========================================================
   Stats Grid
   ========================================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all 0.3s var(--transition);
  box-shadow: var(--shadow);
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--card-glow, transparent);
  opacity: 0.6;
  pointer-events: none;
}
.stat-card.stat-total { --card-glow: radial-gradient(circle at top right, rgba(99,102,241,0.10), transparent 60%); }
.stat-card.stat-completed { --card-glow: radial-gradient(circle at top right, rgba(16,185,129,0.12), transparent 60%); }
.stat-card.stat-pending { --card-glow: radial-gradient(circle at top right, rgba(245,158,11,0.12), transparent 60%); }
.stat-card.stat-overdue { --card-glow: radial-gradient(circle at top right, rgba(239,68,68,0.12), transparent 60%); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.stat-total .stat-icon { background: rgba(99,102,241,0.12); color: var(--primary); }
.stat-completed .stat-icon { background: rgba(16,185,129,0.12); color: var(--success); }
.stat-pending .stat-icon { background: rgba(245,158,11,0.12); color: var(--warning); }
.stat-overdue .stat-icon { background: rgba(239,68,68,0.12); color: var(--danger); }
.stat-icon svg { width: 20px; height: 20px; }

.stat-body { flex: 1; position: relative; z-index: 1; display: flex; flex-direction: column; gap: 2px; }
.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.stat-value {
  font-size: 28px;
  font-weight: 800;
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
}
.stat-trend {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

.stat-spark {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 70px; height: 30px;
  z-index: 0;
  opacity: 0.5;
}

/* =========================================================
   Dashboard Row
   ========================================================= */
.dashboard-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.dashboard-row:nth-of-type(2) { grid-template-columns: 1fr 1fr; }

/* =========================================================
   Productivity Score
   ========================================================= */
.score-display {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 30px;
  align-items: center;
}
.score-ring {
  position: relative;
  width: 200px; height: 200px;
}
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-track { fill: none; stroke: var(--border); stroke-width: 12; }
.score-progress {
  fill: none;
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 540;
  stroke-dashoffset: 540;
  transition: stroke-dashoffset 1.2s var(--transition);
  filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.4));
}
.score-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.score-number {
  font-size: 48px;
  font-weight: 900;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}
.score-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 600;
}

.score-breakdown { display: flex; flex-direction: column; gap: 14px; }
.score-item-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
}
.score-item-head span:last-child {
  font-weight: 700;
  color: var(--text);
}

/* =========================================================
   Weekly Chart
   ========================================================= */
.weekly-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  height: 200px;
  padding: 10px 0 0;
  align-items: end;
  margin-bottom: 16px;
}
.week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}
.week-bars {
  display: flex;
  gap: 3px;
  height: 100%;
  align-items: flex-end;
  width: 100%;
  max-width: 50px;
  justify-content: center;
}
.week-bar {
  width: 10px;
  border-radius: 6px 6px 2px 2px;
  background: var(--gradient);
  transition: all 0.6s var(--transition);
  position: relative;
  min-height: 4px;
}
.week-bar.created { background: linear-gradient(180deg, #06b6d4, #3b82f6); opacity: 0.7; }
.week-bar:hover { transform: scaleY(1.05); transform-origin: bottom; }
.week-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.week-value {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 600;
}
.weekly-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 3px;
}

/* =========================================================
   Insights
   ========================================================= */
.insights-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}
.insight-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: all 0.2s var(--transition);
  animation: slideIn 0.4s var(--transition);
}
.insight-item:hover { transform: translateX(2px); }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}
.insight-icon {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.insight-icon svg { width: 16px; height: 16px; }
.insight-icon.info { background: rgba(6,182,212,0.12); color: var(--info); }
.insight-icon.warning { background: rgba(245,158,11,0.12); color: var(--warning); }
.insight-icon.success { background: rgba(16,185,129,0.12); color: var(--success); }
.insight-icon.tip { background: rgba(139,92,246,0.12); color: var(--primary-2); }
.insight-icon.urgent { background: rgba(239,68,68,0.12); color: var(--danger); }
.insight-content { flex: 1; }
.insight-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.insight-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

/* =========================================================
   Today list (dashboard)
   ========================================================= */
.today-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}
.today-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  transition: all 0.2s var(--transition);
  cursor: pointer;
}
.today-item:hover { background: var(--surface-solid); transform: translateX(2px); }
.today-order {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--gradient);
  color: #fff;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.today-info { flex: 1; min-width: 0; }
.today-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.today-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; }
.today-meta-dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }

/* =========================================================
   Task Table
   ========================================================= */
.task-table-wrap { overflow-x: auto; }
.task-table {
  width: 100%;
  border-collapse: collapse;
}
.task-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.task-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.task-table tr:last-child td { border-bottom: 0; }
.task-table tr { transition: background 0.15s var(--transition); }
.task-table tbody tr:hover { background: var(--surface-2); }

.task-name-cell { display: flex; align-items: center; gap: 10px; }
.task-name-cell .checkbox { flex-shrink: 0; }
.task-name-cell .title { font-weight: 600; color: var(--text); }
.task-name-cell.completed .title { text-decoration: line-through; color: var(--text-muted); }

/* =========================================================
   Tasks Page
   ========================================================= */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.filter-group { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-right { gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s var(--transition);
}
.chip:hover { color: var(--text); }
.chip.active {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px -4px rgba(99, 102, 241, 0.4);
}
.chip-count {
  background: rgba(255, 255, 255, 0.25);
  padding: 0 6px;
  border-radius: 99px;
  font-size: 10.5px;
  min-width: 18px;
  text-align: center;
}
.chip:not(.active) .chip-count { background: var(--border); }

.select {
  height: 36px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 10px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: all 0.15s var(--transition);
}
.select:hover { border-color: var(--border-strong); }
.select:focus { outline: none; border-color: var(--primary); }

/* Task List */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.task-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: all 0.2s var(--transition);
  cursor: grab;
  position: relative;
  animation: taskIn 0.3s var(--transition);
}
@keyframes taskIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.task-item:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.task-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}
.task-item.drag-over { border-color: var(--primary); border-style: dashed; }
.task-item.completed { opacity: 0.65; }
.task-item.completed .task-title { text-decoration: line-through; color: var(--text-muted); }

.drag-handle {
  color: var(--text-muted);
  cursor: grab;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.task-item:hover .drag-handle { opacity: 1; }
.drag-handle svg { width: 16px; height: 16px; display: block; }

.checkbox {
  width: 22px; height: 22px;
  border-radius: 7px;
  border: 2px solid var(--border-strong);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  display: grid; place-items: center;
  transition: all 0.18s var(--transition);
  position: relative;
  padding: 0;
}
.checkbox:hover { border-color: var(--primary); }
.checkbox.checked {
  background: var(--gradient);
  border-color: transparent;
}
.checkbox.checked::after {
  content: '';
  width: 12px; height: 6px;
  border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}
.checkbox svg { width: 12px; height: 12px; color: #fff; display: none; }

.task-content { flex: 1; min-width: 0; }
.task-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.task-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-muted);
}
.task-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.task-meta-item svg { width: 12px; height: 12px; }
.task-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.task-tag {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--border);
  color: var(--text-secondary);
  font-weight: 500;
}

.priority-pill, .status-pill, .category-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
}
.priority-pill { gap: 5px; }
.priority-pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.priority-pill.High { background: rgba(239,68,68,0.10); color: #ef4444; }
.priority-pill.High .dot { background: #ef4444; }
.priority-pill.Medium { background: rgba(245,158,11,0.10); color: #f59e0b; }
.priority-pill.Medium .dot { background: #f59e0b; }
.priority-pill.Low { background: rgba(16,185,129,0.10); color: #10b981; }
.priority-pill.Low .dot { background: #10b981; }
[data-theme="dark"] .priority-pill.High { color: #fca5a5; }
[data-theme="dark"] .priority-pill.Medium { color: #fcd34d; }
[data-theme="dark"] .priority-pill.Low { color: #6ee7b7; }

.status-pill.completed { background: rgba(16,185,129,0.10); color: var(--success); }
.status-pill.pending { background: rgba(99,102,241,0.10); color: var(--primary); }
.status-pill.overdue { background: rgba(239,68,68,0.10); color: var(--danger); }

.category-pill {
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.task-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.18s;
}
.task-item:hover .task-actions { opacity: 1; }
.task-action-btn {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  display: grid; place-items: center;
  cursor: pointer;
  transition: all 0.15s var(--transition);
}
.task-action-btn:hover {
  background: var(--surface-solid);
  color: var(--text);
  border-color: var(--border);
}
.task-action-btn.danger:hover { color: var(--danger); border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.06); }
.task-action-btn svg { width: 14px; height: 14px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-icon {
  width: 72px; height: 72px;
  border-radius: 18px;
  background: var(--gradient-soft);
  color: var(--primary);
  display: grid; place-items: center;
  margin: 0 auto 16px;
}
.empty-icon svg { width: 32px; height: 32px; }
.empty-state h3 { color: var(--text); margin: 0 0 4px; font-size: 18px; }
.empty-state p { margin: 0 0 18px; font-size: 13.5px; }

/* =========================================================
   Calendar
   ========================================================= */
.cal-title {
  font-size: 16px;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
  min-width: 160px;
  text-align: center;
}
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-align: center;
  padding: 8px 0;
}
.cal-day {
  aspect-ratio: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.15s var(--transition);
  position: relative;
  min-height: 80px;
}
.cal-day:hover { background: var(--surface-solid); border-color: var(--border-strong); }
.cal-day.empty { background: transparent; border: none; cursor: default; }
.cal-day.today { border-color: var(--primary); background: var(--gradient-soft); }
.cal-day.selected {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
}
.cal-day.selected .cal-day-num,
.cal-day.selected .cal-task-dot { color: #fff; }
.cal-day-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.cal-day-tasks { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; }
.cal-task-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
}
.cal-task-dot.High { background: #ef4444; }
.cal-task-dot.Medium { background: #f59e0b; }
.cal-task-dot.Low { background: #10b981; }
.cal-task-dot.completed { background: var(--text-muted); opacity: 0.5; }
.cal-more {
  font-size: 9.5px;
  color: var(--text-muted);
  font-weight: 600;
}

/* =========================================================
   Analytics
   ========================================================= */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.chart-wrap {
  position: relative;
  height: 280px;
}

/* =========================================================
   AI Page
   ========================================================= */
.ai-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
}
.ai-summary { grid-column: 1 / -1; }

.ai-header {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}
.ai-avatar {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--gradient);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 8px 24px -6px rgba(99,102,241,0.5);
  position: relative;
}
.ai-avatar::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 18px;
  background: var(--gradient);
  opacity: 0.3;
  z-index: -1;
  filter: blur(12px);
}
.ai-avatar svg { width: 28px; height: 28px; }
.ai-header h3 {
  margin: 0 0 2px;
  font-size: 20px;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.ai-header p { margin: 0; color: var(--text-muted); font-size: 12.5px; }

.ai-briefing {
  background: var(--gradient-soft);
  border-radius: 14px;
  padding: 18px;
  line-height: 1.6;
  font-size: 14px;
  color: var(--text);
  border: 1px solid var(--border);
}
.ai-briefing p { margin: 0 0 8px; }
.ai-briefing p:last-child { margin: 0; }
.ai-briefing strong { color: var(--primary); }

.ai-suggestions, .ai-plan, .ai-quick-wins, .ai-urgent, .ai-tips {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-suggest-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.18s var(--transition);
}
.ai-suggest-row:hover { background: var(--surface-solid); }
.ai-suggest-info { flex: 1; min-width: 0; }
.ai-suggest-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-suggest-reason { font-size: 11.5px; color: var(--text-muted); }
.ai-suggest-priority {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 7px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ai-suggest-priority.High { background: rgba(239,68,68,0.12); color: #ef4444; }
.ai-suggest-priority.Medium { background: rgba(245,158,11,0.12); color: #f59e0b; }
.ai-suggest-priority.Low { background: rgba(16,185,129,0.12); color: #10b981; }
[data-theme="dark"] .ai-suggest-priority.High { color: #fca5a5; }
[data-theme="dark"] .ai-suggest-priority.Medium { color: #fcd34d; }
[data-theme="dark"] .ai-suggest-priority.Low { color: #6ee7b7; }

.ai-empty {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
}

.tip-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.tip-item-icon {
  width: 28px; height: 28px;
  background: var(--gradient-soft);
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--primary);
  flex-shrink: 0;
}
.tip-item-icon svg { width: 14px; height: 14px; }
.tip-item-content { flex: 1; }
.tip-item-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.tip-item-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

/* =========================================================
   Settings
   ========================================================= */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.setting-row:last-child { border-bottom: 0; padding-bottom: 0; }
.setting-label { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.setting-desc { font-size: 12px; color: var(--text-muted); }
.theme-switch {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.theme-opt {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s var(--transition);
}
.theme-opt.active {
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.shortcuts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.shortcuts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.shortcut {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.shortcut kbd {
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Inter', monospace;
  min-width: 22px;
  text-align: center;
}
.shortcut span { margin-left: auto; }

.about-row { display: flex; gap: 6px; margin-top: 12px; }

/* =========================================================
   Modal
   ========================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: modalIn 0.25s var(--transition);
}
.modal[hidden] { display: none !important; }
@keyframes modalIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, 0.6); }
.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalPop 0.3s var(--transition);
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-dialog.modal-sm { max-width: 420px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--border);
}

/* Form */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 10px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: all 0.15s var(--transition);
  font-family: inherit;
}
.form-group textarea { resize: vertical; min-height: 70px; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  background: var(--surface-solid);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.10);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ai-suggestion-box {
  background: var(--gradient-soft);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 14px;
  margin-top: 4px;
}
.ai-suggestion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.ai-pill {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  background: var(--gradient);
  color: #fff;
  border-radius: 7px;
}
.link-btn {
  background: none;
  border: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.link-btn:hover { background: var(--surface-2); }
.ai-suggestion-text { font-size: 12.5px; color: var(--text); margin: 0; line-height: 1.4; }

/* =========================================================
   Toast
   ========================================================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  pointer-events: none;
}
.toast {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.4s var(--transition);
  min-width: 280px;
  position: relative;
  overflow: hidden;
}
.toast::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--toast-color, var(--primary));
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast.removing { animation: toastOut 0.3s var(--transition) forwards; }
@keyframes toastOut {
  to { opacity: 0; transform: translateX(40px); }
}
.toast-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
  flex-shrink: 0;
  color: #fff;
  background: var(--toast-color, var(--primary));
}
.toast-icon svg { width: 14px; height: 14px; }
.toast-content { flex: 1; }
.toast-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.toast-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.3;
}
.toast-close {
  background: none;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
}
.toast-close:hover { color: var(--text); }
.toast-close svg { width: 14px; height: 14px; display: block; }

.toast.success { --toast-color: var(--success); }
.toast.error { --toast-color: var(--danger); }
.toast.warning { --toast-color: var(--warning); }
.toast.info { --toast-color: var(--info); }

/* =========================================================
   Mobile / Responsive
   ========================================================= */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-row, .dashboard-row:nth-of-type(2), .ai-grid, .analytics-grid, .settings-grid { grid-template-columns: 1fr; }
  .score-display { grid-template-columns: 1fr; justify-items: center; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.3s var(--transition);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: grid; }
  .sidebar-toggle { display: grid; }
  .topbar { padding: 0 16px; }
  .page { padding: 20px 16px 40px; }
  .page-title { font-size: 24px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .search-wrap { max-width: none; }
  .kbd { display: none; }
  .topbar-right .btn span { display: none; }
  .topbar-right .btn { padding: 9px 12px; }
}

@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
  .filters-bar { flex-direction: column; align-items: stretch; }
  .filter-right { width: 100%; }
  .filter-right .select { flex: 1; }
  .cal-day { min-height: 60px; padding: 4px; }
  .cal-day-num { font-size: 11px; }
  .task-actions { opacity: 1; }
  .page-head { flex-direction: column; align-items: stretch; }
  .modal { padding: 12px; }
  .modal-dialog { max-height: 95vh; }
  .toast-container { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
