/* Modern Minimalist SaaS Theme (Linear / Todoist Style) - Task Workspace */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-subtle: #f5f7ff;
  
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --border-light: #e2e8f0;
  --border-subtle: #f1f5f9;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-drawer: 0 20px 25px -5px rgba(15, 23, 42, 0.15);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --sidebar-width: 270px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button,
.nav-item-btn,
.filter-pill,
.task-check-round,
.btn-task-action,
.btn-sync-pill,
.btn-topbar-analytics,
.btn-topbar-profile {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* App Container Layout (Sidebar + Main View) */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ====================================================
   SIDEBAR (Desktop Fixed / Mobile Slide-Out Drawer)
   ==================================================== */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-header {
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
}

.sidebar-brand img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.sidebar-brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sidebar-brand-name span {
  color: var(--primary);
}

.badge-ai {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
}

.btn-sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

/* Sidebar Nav Scroll Area */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.85rem;
}

.nav-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.6rem 0.75rem 0.35rem;
  margin-top: 0.5rem;
}

.nav-section-title:first-child {
  margin-top: 0;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.nav-item-btn .item-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.nav-item-btn .item-left i {
  font-size: 0.95rem;
  width: 18px;
  text-align: center;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.nav-item-btn .count-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.nav-item-btn:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

.nav-item-btn:hover i {
  color: var(--primary);
}

.nav-item-btn.active {
  background-color: var(--primary-light);
  color: var(--primary);
}

.nav-item-btn.active i {
  color: var(--primary);
}

.nav-item-btn.active .count-badge {
  background-color: rgba(79, 70, 229, 0.15);
  color: var(--primary);
}

/* Category Color Dots */
.color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-work { background-color: #4f46e5; }
.dot-personal { background-color: #f59e0b; }
.dot-health { background-color: #10b981; }
.dot-education { background-color: #0284c7; }

/* Sidebar Productivity Mini Card */
.sidebar-productivity-card {
  margin: 1.25rem 0.25rem 0.5rem;
  background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.productivity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.productivity-header span {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.productivity-progress-bar {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #3b82f6);
  border-radius: 10px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-open-analytics {
  width: 100%;
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--bg-surface);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-open-analytics:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Sidebar Footer / User Profile */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-surface);
}

.user-profile-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border-light);
  flex-shrink: 0;
}

.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-display-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout-icon {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1rem;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-logout-icon:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Mobile Sidebar Backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 999;
}

/* ====================================================
   MAIN CONTENT AREA
   ==================================================== */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-y: auto;
}

/* Top App Header */
.app-topbar {
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  padding: 0.75rem 1.75rem;
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.topbar-brand-mobile {
  display: none;
  align-items: center;
  gap: 0.45rem;
}

.topbar-mobile-logo {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.topbar-mobile-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.topbar-mobile-title span {
  color: var(--primary);
}

.btn-menu-toggle {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.4rem 0.55rem;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-menu-toggle:hover {
  background: var(--bg-subtle);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

/* Sync Button Pill */
.btn-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-sync-pill:hover {
  background: var(--bg-subtle);
  border-color: #cbd5e1;
}

/* Topbar Analytics Action Button */
.btn-topbar-analytics {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--primary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-topbar-analytics:hover {
  background: var(--primary-light);
  border-color: #c7d2fe;
}

/* Topbar Profile Avatar & Dropdown */
.btn-topbar-profile {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  outline: none;
  transition: transform 0.15s ease;
}

.btn-topbar-profile:hover {
  transform: scale(1.05);
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 28px -6px rgba(15, 23, 42, 0.18), 0 4px 10px rgba(0, 0, 0, 0.05);
  min-width: 220px;
  padding: 0.6rem 0;
  z-index: 1050;
  animation: dropdownFadeIn 0.15s ease;
}

.profile-dropdown.hidden {
  display: none;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.profile-dropdown-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
}

.dropdown-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.dropdown-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dropdown-user-meta strong {
  font-size: 0.88rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-user-meta span {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.4rem 0;
}

.profile-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.profile-dropdown-item:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.profile-dropdown-item.text-danger {
  color: #ef4444;
}

.profile-dropdown-item.text-danger:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Feed Welcome Header */
.feed-welcome-header {
  margin-bottom: 1.5rem;
}

.welcome-text-group h2 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 0.35rem;
}

.welcome-text-group p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}

/* Search Input */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box i {
  position: absolute;
  left: 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.search-input {
  padding: 0.45rem 0.85rem 0.45rem 2.2rem;
  font-size: 0.85rem;
  font-family: inherit;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  outline: none;
  width: 200px;
  transition: all 0.2s ease;
}

.search-input:focus {
  background-color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
  width: 250px;
}

/* Main Feed Container */
.feed-container {
  flex: 1;
  max-width: 940px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ====================================================
   MODERN UNIFIED TASK ADD BAR
   ==================================================== */
.task-add-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 0.5rem 0.6rem 0.5rem 1.25rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: all 0.2s ease;
}

.task-add-card:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1), var(--shadow-hover);
}

.task-add-main-row {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.task-add-icon {
  color: var(--primary);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.task-add-input {
  flex: 1;
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.65rem 0;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
}

.task-add-input::placeholder {
  color: var(--text-muted);
}

.task-add-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

/* Clean Custom Date Pill */
.btn-date-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-secondary);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-date-pill:hover,
.btn-date-pill.has-date {
  background-color: var(--primary-light);
  border-color: #c7d2fe;
  color: var(--primary);
}

.btn-submit-task {
  padding: 0.55rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: inherit;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
  white-space: nowrap;
}

.btn-submit-task:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #2563eb 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(79, 70, 229, 0.35);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  color: var(--text-secondary);
  padding: 0.65rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: #94a3b8;
}

/* ====================================================
   QUICK FILTER PILLS
   ==================================================== */
.filter-pills-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  scrollbar-width: none;
}

.filter-pills-bar::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.filter-pill:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.filter-pill.active {
  background: var(--text-primary);
  color: #ffffff;
  border-color: var(--text-primary);
}

/* ====================================================
   UNIFIED TASK FEED & ITEMS
   ==================================================== */
.tasks-feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  padding: 0 0.25rem;
}

.feed-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tasks-container {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* Single Unified Task Card */
.task-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  position: relative;
}

.task-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}

.task-card-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
  min-width: 0;
}

/* Round Checkbox */
.task-checkbox-wrapper {
  position: relative;
  flex-shrink: 0;
}

.task-check-round {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
}

.task-check-round i {
  color: #ffffff;
  font-size: 0.65rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.task-card.completed .task-check-round {
  background-color: #10b981;
  border-color: #10b981;
}

.task-card.completed .task-check-round i {
  opacity: 1;
}

.task-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
  transition: all 0.2s ease;
}

.task-card.completed .task-title {
  color: var(--text-muted);
  text-decoration: line-through;
}

/* Meta Badges (Category, Priority, Date) */
.task-card-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.task-badges-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* AI Category Badges */
.badge-category {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.cat-work {
  background: #e0e7ff;
  color: #4338ca;
}

.cat-personal, .cat-household {
  background: #fef3c7;
  color: #92400e;
}

.cat-health {
  background: #d1fae5;
  color: #065f46;
}

.cat-education {
  background: #dbeafe;
  color: #1e40af;
}

/* AI Priority Badges */
.badge-priority {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.prio-high {
  background: #fee2e2;
  color: #991b1b;
}

.prio-med {
  background: #fef3c7;
  color: #b45309;
}

.prio-low {
  background: #f1f5f9;
  color: #475569;
}

/* Overdue Warning Badge */
.prio-overdue {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  animation: pulseWarning 2s infinite ease-in-out;
}

@keyframes pulseWarning {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

/* Date Badge */
.badge-date {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  background: var(--bg-subtle);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.badge-date.is-overdue {
  background: #fef2f2;
  color: #dc2626;
  font-weight: 700;
  border: 1px solid #fecaca;
}

.badge-date.is-due-soon {
  background: #fffbeb;
  color: #b45309;
  font-weight: 700;
  border: 1px solid #fde68a;
}

.task-card.is-overdue {
  border-left: 4px solid #ef4444 !important;
  background-color: #fffafb;
}

/* Ensure Flatpickr Calendar is always on top of modals and drawers */
.flatpickr-calendar {
  z-index: 999999 !important;
  box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.08) !important;
  border-radius: 12px !important;
}

/* In-App Reminder Toast Notification */
.reminder-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #0f172a;
  color: #ffffff;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  z-index: 99999;
  animation: slideToastUp 0.35s ease;
  max-width: 380px;
}

@keyframes slideToastUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reminder-toast .toast-icon {
  font-size: 1.5rem;
  color: #f59e0b;
}

.reminder-toast .toast-content strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.2rem;
}

.reminder-toast .toast-content p {
  font-size: 0.82rem;
  color: #94a3b8;
  margin: 0;
}

.reminder-toast .toast-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.2rem;
  font-size: 1rem;
}

.reminder-toast .toast-close:hover {
  color: #ffffff;
}

/* Topbar Notification Button */
.btn-topbar-notif {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.92rem;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-topbar-notif:hover,
.btn-topbar-notif.active {
  color: #f59e0b;
  border-color: #fde68a;
  background: #fffbeb;
}

/* Actions (Edit / Delete) */
.task-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.task-card:hover .task-actions {
  opacity: 1;
}

.btn-task-action {
  background: transparent;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-task-action:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.btn-task-action.delete:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Empty State Card */
.empty-tasks-state {
  background: var(--bg-surface);
  border: 1.5px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: 3.5rem 1.5rem;
  text-align: center;
}

.empty-tasks-state .empty-icon {
  font-size: 2.5rem;
  color: #c7d2fe;
  margin-bottom: 1rem;
}

.empty-tasks-state h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.empty-tasks-state p {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 320px;
  margin: 0 auto;
}

/* ====================================================
   WEEKLY ANALYTICS MODAL (CLEAN POPUP)
   ==================================================== */
.modal-analytics {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 2000;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.modal-analytics.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.analytics-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 620px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

#edit-task-modal .analytics-card {
  overflow: visible !important;
}

.analytics-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.analytics-card-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
}

.btn-close-modal:hover {
  color: var(--text-primary);
}

.analytics-card-body {
  padding: 1.5rem;
}

.analytics-stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.analytics-stat-item {
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  text-align: center;
}

.analytics-stat-item .stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.analytics-stat-item .stat-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* ====================================================
   MOBILE RESPONSIVENESS (< 860px)
   ==================================================== */
@media (max-width: 860px) {
  /* Sidebar as Drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-drawer);
    z-index: 1100;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .btn-sidebar-close {
    display: block;
  }

  .app-topbar {
    padding: 0.6rem 0.85rem;
    gap: 0.5rem;
  }

  .btn-menu-toggle {
    display: flex;
    width: 34px;
    height: 34px;
    padding: 0;
  }

  .topbar-brand-mobile {
    display: flex;
    gap: 0.35rem;
  }

  .topbar-mobile-logo {
    width: 22px;
    height: 22px;
  }

  .topbar-mobile-title {
    font-size: 0.98rem;
  }

  .topbar-text-desktop {
    display: none !important;
  }

  .btn-sync-pill,
  .btn-topbar-analytics,
  .btn-topbar-profile,
  .btn-topbar-notif {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.92rem;
    flex-shrink: 0;
  }

  .search-box {
    display: none; /* Can be opened on tap */
  }

  .feed-container {
    padding: 1.25rem 0.85rem 3.5rem;
  }

  /* Task Card Mobile Ergonomics */
  .task-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.9rem 1rem;
  }

  .task-card-left {
    width: 100%;
  }

  .task-card-right {
    width: 100%;
    justify-content: space-between;
    padding-top: 0.4rem;
    border-top: 1px dashed var(--border-subtle);
  }

  .task-actions {
    opacity: 1;
  }

  /* Task Add Bar on Mobile */
  .task-add-card {
    padding: 0.85rem 1rem;
    gap: 0.75rem;
    flex-direction: column;
    align-items: stretch;
  }

  .task-add-main-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
  }

  .task-add-input {
    width: 100%;
    padding: 0.4rem 0;
    font-size: 0.95rem;
  }

  .task-add-actions {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.45rem;
    border-top: 1px dashed var(--border-subtle);
  }

  .btn-date-pill {
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
  }

  .btn-submit-task {
    flex: 1;
    max-width: 140px;
    justify-content: center;
    padding: 0.55rem 1rem;
  }
}
