@import url('variables.css');

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  line-height: 1.6;
}

#app-preloader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 42%, rgba(99, 102, 241, .14), transparent 34%),
    var(--bg-primary);
  opacity: 1;
  visibility: visible;
  transition: opacity .45s ease, visibility .45s ease;
}

.preloader-card {
  width: min(320px, 100%);
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 30px 28px 26px;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  background: color-mix(in srgb, var(--bg-card) 92%, transparent);
  box-shadow: 0 24px 70px rgba(15, 23, 42, .14);
  backdrop-filter: blur(16px);
}

.preloader-logo {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fff;
  font-size: 24px;
  background: var(--accent-gradient);
  box-shadow: var(--shadow-glow);
  animation: preloaderFloat 1.8s ease-in-out infinite;
}

.preloader-ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  padding: 4px;
  background: conic-gradient(var(--accent-primary), rgba(99, 102, 241, .08), var(--accent-primary));
  animation: preloaderSpin 1.05s linear infinite;
}

.preloader-ring span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--bg-card);
}

.preloader-copy {
  display: grid;
  gap: 3px;
  text-align: center;
}

.preloader-copy strong {
  font-size: 1.1rem;
  letter-spacing: -.02em;
}

.preloader-copy span {
  color: var(--text-muted);
  font-size: .78rem;
}

.preloader-progress {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-primary) 10%, transparent);
}

.preloader-progress span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-gradient);
  animation: preloaderProgress 1.15s ease-in-out infinite;
}

body.app-ready #app-preloader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes preloaderSpin { to { transform: rotate(360deg); } }
@keyframes preloaderFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes preloaderProgress {
  0% { transform: translateX(-115%); }
  100% { transform: translateX(270%); }
}

@media (prefers-reduced-motion: reduce) {
  .preloader-logo, .preloader-ring, .preloader-progress span { animation: none; }
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: var(--border-radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

::selection { background: var(--accent-primary); color: var(--text-inverse); }

#sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: var(--z-sidebar);
  transition: width var(--transition-normal), transform var(--transition-normal), background var(--transition-normal);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

#sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border-color);
  min-height: var(--header-height);
  text-decoration: none;
  overflow: hidden;
}

.sidebar-logo .logo-icon {
  width: 40px; height: 40px;
  background: var(--accent-gradient);
  border-radius: var(--border-radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
  font-size: 18px;
  color: white;
}

.sidebar-logo .logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  white-space: nowrap;
  transition: opacity var(--transition-normal);
}

.sidebar-logo .logo-text span {
  color: var(--accent-primary);
}

#sidebar.collapsed .logo-text,
#sidebar.collapsed .nav-label,
#sidebar.collapsed .sidebar-section-title,
#sidebar.collapsed .sidebar-footer-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 0;
}

.sidebar-section-title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 8px 20px 4px;
  margin-top: 8px;
  white-space: nowrap;
  transition: opacity var(--transition-normal);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  cursor: pointer;
  border-radius: 0;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--accent-primary);
  border-left-color: var(--accent-primary);
}

.nav-item.active {
  background: var(--accent-primary-light);
  color: var(--accent-primary);
  font-weight: 600;
  border-left-color: var(--accent-primary);
}

[data-theme="dark"] .nav-item.active {
  background: rgba(129, 140, 248, 0.15);
}

.nav-item .nav-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
}

.nav-item.active .nav-icon {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.nav-label {
  font-size: 0.875rem;
  transition: opacity var(--transition-normal);
}

.nav-badge {
  margin-left: auto;
  background: var(--accent-primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--border-radius-full);
  flex-shrink: 0;
  transition: opacity var(--transition-normal);
}

.nav-badge.danger { background: var(--priority-high); }
.nav-badge.warning { background: var(--priority-medium); }
.nav-badge.success { background: var(--priority-low); }

#sidebar.collapsed .nav-badge { opacity: 0; width: 0; padding: 0; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border-color);
}

.sidebar-footer-text {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  transition: opacity var(--transition-normal);
  margin-top: 6px;
}

#sidebar-toggle {
  position: absolute;
  top: 20px;
  right: 5px;
  width: 28px; height: 28px;
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--border-radius-full);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
  z-index: 10;
}

#sidebar-toggle:hover { transform: scale(1.1); background: var(--accent-primary-hover); }

#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: calc(var(--z-sidebar) - 1);
  backdrop-filter: blur(2px);
}

#main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-normal);
  min-width: 0;
}

#main-wrapper.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed);
}

#topbar {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  transition: background var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.page-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.search-wrapper {
  position: relative;
  flex: 1;
  max-width: 420px;
}

.search-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

#global-search {
  width: 100%;
  padding: 10px 16px 10px 42px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-input);
  border-radius: var(--border-radius-full);
  font-family: var(--font-primary);
  font-size: 0.875rem;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

#global-search:focus {
  border-color: var(--border-focus);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

#global-search::placeholder { color: var(--text-muted); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  width: 40px; height: 40px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: var(--border-radius-md);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 15px;
  transition: all var(--transition-fast);
  position: relative;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

#add-task-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: var(--border-radius-md);
  font-family: var(--font-primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
  flex-shrink: 0;
}

#add-task-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

#add-task-btn:active { transform: translateY(0); }

#mobile-menu-btn {
  display: none;
  width: 40px; height: 40px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: var(--border-radius-md);
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 16px;
  flex-shrink: 0;
}

#main-content {
  flex: 1;
  padding: 28px 28px;
  overflow-y: auto;
}

.view-page {
  display: none;
  animation: fadeInUp 0.3s ease;
}

.view-page.active {
  display: block;
}

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

.dashboard-header {
  margin-bottom: 28px;
}

.welcome-text {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.welcome-text span { color: var(--accent-primary); }

.welcome-date {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-clock {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--accent-primary);
  font-weight: 600;
  background: var(--accent-primary-light);
  padding: 3px 10px;
  border-radius: var(--border-radius-full);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.06;
  transform: translate(20px, -20px);
}

.stat-card.total::before { background: var(--accent-primary); }
.stat-card.completed::before { background: var(--status-completed); }
.stat-card.inprogress::before { background: var(--status-inprogress); }
.stat-card.overdue::before { background: var(--status-overdue); }

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 50px; height: 50px;
  border-radius: var(--border-radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-card.total .stat-icon { background: var(--accent-primary-light); color: var(--accent-primary); }
.stat-card.completed .stat-icon { background: var(--status-completed-bg); color: var(--status-completed); }
.stat-card.inprogress .stat-icon { background: var(--status-inprogress-bg); color: var(--status-inprogress); }
.stat-card.overdue .stat-icon { background: var(--status-overdue-bg); color: var(--status-overdue); }

.stat-info { flex: 1; min-width: 0; }
.stat-number {
  font-size: 1.9rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.progress-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 22px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-card);
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.progress-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.progress-percent {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-primary);
}

.progress-bar-container {
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-full);
  height: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--border-radius-full);
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.dashboard-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title i { color: var(--accent-primary); }

.section-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 7px 14px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--border-radius-full);
  font-family: var(--font-primary);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-primary-light);
}

.filter-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.filter-select {
  padding: 7px 32px 7px 12px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--border-radius-full);
  font-family: var(--font-primary);
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: all var(--transition-fast);
}

.filter-select:focus {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.view-toggle {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border-radius: var(--border-radius-md);
  padding: 4px;
  border: 1px solid var(--border-color);
}

.view-toggle-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.view-toggle-btn.active {
  background: var(--bg-secondary);
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

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

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border-left: 4px solid transparent;
}

.task-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-primary);
}

.task-card.priority-high { border-left-color: var(--priority-high); }
.task-card.priority-medium { border-left-color: var(--priority-medium); }
.task-card.priority-low { border-left-color: var(--priority-low); }
.task-card.completed-task { opacity: 0.7; }
.task-card.completed-task .task-title { text-decoration: line-through; color: var(--text-muted); }

.task-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.task-checkbox {
  width: 20px; height: 20px;
  border: 2px solid var(--border-input);
  border-radius: 6px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all var(--transition-fast);
}

.task-checkbox:hover { border-color: var(--accent-primary); }
.task-checkbox.checked {
  background: var(--status-completed);
  border-color: var(--status-completed);
  color: white;
}

.task-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  line-height: 1.4;
  word-break: break-word;
}

.task-important-star {
  color: var(--priority-medium);
  font-size: 14px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.task-important-star:hover { transform: scale(1.3); }
.task-important-star.starred { color: #f59e0b; }
.task-important-star.not-starred { color: var(--border-color); }

.task-description {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.task-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--border-radius-full);
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-high { background: var(--priority-high-bg); color: var(--priority-high); border: 1px solid var(--priority-high-border); }
.badge-medium { background: var(--priority-medium-bg); color: var(--priority-medium); border: 1px solid var(--priority-medium-border); }
.badge-low { background: var(--priority-low-bg); color: var(--priority-low); border: 1px solid var(--priority-low-border); }

.badge-work { background: var(--cat-work-bg); color: var(--cat-work); }
.badge-study { background: var(--cat-study-bg); color: var(--cat-study); }
.badge-personal { background: var(--cat-personal-bg); color: var(--cat-personal); }
.badge-health { background: var(--cat-health-bg); color: var(--cat-health); }

.task-date {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.task-date.overdue { color: var(--priority-high); font-weight: 600; }
.task-date.today { color: var(--priority-medium); font-weight: 600; }

.task-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.task-action-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: var(--border-radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  transition: all var(--transition-fast);
}

.task-action-btn:hover { background: var(--bg-hover); color: var(--accent-primary); border-color: var(--accent-primary); }
.task-action-btn.delete:hover { color: var(--priority-high); border-color: var(--priority-high); background: var(--priority-high-bg); }

.task-list-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  border-left: 4px solid transparent;
}

.task-list-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.task-list-item.priority-high { border-left-color: var(--priority-high); }
.task-list-item.priority-medium { border-left-color: var(--priority-medium); }
.task-list-item.priority-low { border-left-color: var(--priority-low); }

.task-list-info { flex: 1; min-width: 0; }
.task-list-title { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.task-list-title.done { text-decoration: line-through; color: var(--text-muted); }
.task-list-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

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

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
  color: var(--border-color);
}

.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }
.empty-state p { font-size: 0.85rem; }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-overlay.show {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-modal);
  border-radius: var(--border-radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s var(--transition-spring);
  border: 1px solid var(--border-color);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border-color);
  position: sticky; top: 0;
  background: var(--bg-modal);
  z-index: 1;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 10px;
}

.modal-title i { color: var(--accent-primary); }

.modal-close {
  width: 34px; height: 34px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  border-radius: var(--border-radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  transition: all var(--transition-fast);
}

.modal-close:hover { background: var(--priority-high-bg); color: var(--priority-high); border-color: var(--priority-high); }

.modal-body { padding: 22px 24px; }

.project-info-modal {
  max-width: 620px;
  overflow: hidden;
}

.project-info-header {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-primary) 10%, var(--bg-card)), var(--bg-card));
}

.project-info-body {
  padding: 24px;
}

.project-info-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--border-color);
  border-radius: 18px;
  background: var(--bg-secondary);
}

.project-info-icon {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  color: #fff;
  font-size: 24px;
  background: var(--accent-gradient);
  box-shadow: var(--shadow-glow);
}

.project-info-kicker {
  margin-bottom: 3px;
  color: var(--accent-primary);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .12em;
}

.project-info-hero h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.35rem;
}

.project-info-hero p {
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: .84rem;
  line-height: 1.6;
}

.project-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.project-info-card {
  display: flex;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--bg-card);
}

.project-info-card > i {
  margin-top: 2px;
  color: var(--accent-primary);
}

.project-info-card div {
  display: grid;
  gap: 3px;
}

.project-info-card strong {
  font-size: .78rem;
  color: var(--text-primary);
}

.project-info-card span {
  color: var(--text-muted);
  font-size: .7rem;
  line-height: 1.45;
}

.project-info-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 18px 24px 20px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  background: var(--bg-secondary);
}

.project-info-footer span {
  color: var(--text-muted);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.project-info-footer strong {
  color: var(--text-primary);
  font-size: .98rem;
}

.project-info-footer em {
  color: var(--accent-primary);
  font-size: .72rem;
  font-style: normal;
  font-weight: 700;
}

@media (max-width: 620px) {
  .project-info-grid { grid-template-columns: 1fr; }
  .project-info-hero { align-items: flex-start; }
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-modal);
  position: sticky; bottom: 0;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-label i { color: var(--accent-primary); margin-right: 4px; }

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-input);
  border-radius: var(--border-radius-md);
  font-family: var(--font-primary);
  font-size: 0.875rem;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.form-control:focus {
  border-color: var(--border-focus);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-switch {
  position: relative;
  width: 44px; height: 24px;
}

.toggle-switch input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-input);
  border-radius: var(--border-radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider { background: var(--accent-primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--border-radius-md);
  font-family: var(--font-primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-secondary);
  border-color: var(--border-color);
}

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

.btn-danger {
  background: var(--priority-high-bg);
  color: var(--priority-high);
  border-color: var(--priority-high-border);
}

.btn-danger:hover { background: var(--priority-high); color: white; }

.calendar-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.calendar-nav-btn {
  width: 36px; height: 36px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
}

.calendar-nav-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

.calendar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-day-header {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 12px 4px;
  border-bottom: 1px solid var(--border-color);
}

.calendar-day {
  min-height: 90px;
  padding: 8px 6px;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.calendar-day:hover { background: var(--bg-hover); }
.calendar-day.other-month { opacity: 0.4; }

.calendar-day.today .day-number {
  background: var(--accent-primary);
  color: white;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.day-number {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.day-task-dot {
  width: 100%;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  align-items: start;
}

.kanban-column {
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-lg);
  padding: 16px;
  min-height: 400px;
  border: 1px solid var(--border-color);
}

.kanban-column.drag-over {
  background: var(--accent-primary-light);
  border-color: var(--accent-primary);
  border-style: dashed;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 2px solid;
}

.kanban-col-header.todo { border-color: var(--priority-medium); }
.kanban-col-header.inprogress { border-color: var(--accent-primary); }
.kanban-col-header.done { border-color: var(--priority-low); }

.kanban-col-title {
  font-size: 0.9rem;
  font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}

.kanban-count {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--border-radius-full);
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 14px;
  margin-bottom: 10px;
  cursor: grab;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
}

.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card:active { cursor: grabbing; opacity: 0.8; }
.kanban-card.priority-high { border-left-color: var(--priority-high); }
.kanban-card.priority-medium { border-left-color: var(--priority-medium); }
.kanban-card.priority-low { border-left-color: var(--priority-low); }
.kanban-card.dragging { opacity: 0.4; transform: rotate(2deg); }

.kanban-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
}

.analytics-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 8px;
}

.analytics-card-title i { color: var(--accent-primary); }

.category-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-bar-label {
  width: 70px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.category-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-full);
  overflow: hidden;
}

.category-bar-fill {
  height: 100%;
  border-radius: var(--border-radius-full);
  transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.category-bar-count {
  width: 24px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: right;
}

.weekly-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
}

.week-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.week-bar {
  width: 100%;
  background: var(--accent-gradient);
  border-radius: 4px 4px 0 0;
  transition: height 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 4px;
  cursor: pointer;
}

.week-bar:hover { opacity: 0.8; }

.week-bar-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.week-bar-value {
  font-size: 0.7rem;
  color: var(--accent-primary);
  font-weight: 700;
  font-family: var(--font-mono);
}

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-xl);
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  animation: toastIn 0.4s var(--transition-spring) forwards;
  border-left: 4px solid transparent;
}

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

.toast.hiding { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(0.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(40px) scale(0.9); }
}

.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--toast-success); }
.toast.error .toast-icon { color: var(--toast-error); }
.toast.warning .toast-icon { color: var(--toast-warning); }
.toast.info .toast-icon { color: var(--toast-info); }

.toast-content { flex: 1; }
.toast-title { font-size: 0.875rem; font-weight: 700; color: var(--text-primary); }
.toast-message { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }

.toast-close {
  width: 24px; height: 24px;
  border: none; background: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.toast-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
}

.divider {
  height: 1px;
  background: var(--border-color);
  margin: 16px 0;
}

.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 14px; }
.gap-lg { gap: 20px; }

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

.highlight {
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-primary);
  border-radius: 2px;
  padding: 0 2px;
}

.drag-ghost {
  opacity: 0.5;
}

.confirm-modal {
  max-width: 400px;
}

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.recent-task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.recent-task-item:last-child { border-bottom: none; }

.recent-task-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.recent-task-info { flex: 1; min-width: 0; }
.recent-task-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.recent-task-title.done { text-decoration: line-through; color: var(--text-muted); }
.recent-task-date { font-size: 0.73rem; color: var(--text-muted); }

.priority-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.priority-dot.high { background: var(--priority-high); }
.priority-dot.medium { background: var(--priority-medium); }
.priority-dot.low { background: var(--priority-low); }

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--border-radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: var(--z-tooltip);
}

[data-tooltip]:hover::after { opacity: 1; }

#sidebar.collapsed .nav-item[data-tooltip]::after {
  left: calc(100% + 10px);
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
}
