/* ============================================================
   TaskFlow Pro - style.css
   Design premium, responsivo, nativo-like
   ============================================================ */

/* =================== CSS VARIABLES =================== */
:root {
  /* Cores base - dark (padrão) */
  --bg-base: #0f172a;
  --bg-surface: #1e293b;
  --bg-elevated: #293548;
  --bg-hover: #334155;
  --bg-input: #1e293b;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  --border-color: #334155;
  --border-light: #1e293b;

  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: rgba(99, 102, 241, 0.15);

  --success: #22c55e;
  --success-light: rgba(34, 197, 94, 0.15);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.15);
  --info: #3b82f6;
  --info-light: rgba(59, 130, 246, 0.15);

  --priority-low: #22c55e;
  --priority-medium: #f59e0b;
  --priority-high: #fb923c;
  --priority-urgent: #ef4444;

  --sidebar-w: 260px;
  --bottom-nav-h: 64px;
  --header-h: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

[data-theme="light"] {
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-hover: #e2e8f0;
  --bg-input: #f8fafc;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --border-color: #e2e8f0;
  --border-light: #f1f5f9;

  --accent-light: rgba(99, 102, 241, 0.1);
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
}

/* =================== RESET & BASE =================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.5;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--accent); text-decoration: none; cursor: pointer; }
a:hover { opacity: 0.85; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

/* =================== SCROLLBAR =================== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 99px; }

/* =================== UTILITY =================== */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* =================== LOADING OVERLAY =================== */
.loading-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg-base);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.4s ease;
}
.loading-overlay.fade-out { opacity: 0; pointer-events: none; }
.loading-content { text-align: center; }
.loading-logo { font-size: 56px; animation: pulse 1s infinite; }
.loading-title { font-size: 24px; font-weight: 800; color: var(--accent); margin-top: 12px; letter-spacing: -0.5px; }
.loading-bar {
  margin-top: 24px;
  width: 200px;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
}
.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  border-radius: 99px;
  animation: loadBar 1.5s ease forwards;
}

@keyframes loadBar { from { width: 0; } to { width: 100%; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes slideIn { from { transform: translateX(-20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(110%); } }

/* =================== AUTH SCREEN =================== */
.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(ellipse at 60% 20%, rgba(99,102,241,0.15) 0%, transparent 60%),
              var(--bg-base);
  animation: fadeIn 0.4s ease;
}

.auth-container {
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo-icon { font-size: 52px; display: block; margin-bottom: 8px; }
.auth-logo-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -1px;
}
.auth-logo-sub { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

.auth-form {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.3s ease;
}

.auth-form-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-form-sub { color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-secondary); }
.auth-switch a { color: var(--accent); font-weight: 600; }

/* =================== FORMS =================== */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  padding: 11px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.form-input::placeholder { color: var(--text-muted); }

.form-textarea { min-height: 90px; resize: vertical; }
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.input-with-icon { position: relative; }
.input-with-icon .form-input { padding-right: 44px; }
.input-icon-btn {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: var(--text-muted); font-size: 16px;
  padding: 4px;
}

.form-error {
  background: var(--danger-light);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

/* =================== BUTTONS =================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border-color);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border: 1.5px solid var(--danger);
}
.btn-danger-ghost:hover { background: var(--danger-light); }

.btn-full { width: 100%; justify-content: center; padding: 13px 18px; font-size: 15px; }
.btn-sm { padding: 7px 13px; font-size: 13px; }

/* =================== APP LAYOUT =================== */
.app-main {
  display: flex;
  min-height: 100dvh;
}

/* =================== SIDEBAR =================== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition), width var(--transition);
}

.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .nav-text,
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .profile-info,
.sidebar.collapsed .profile-menu-btn,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .nav-add-btn,
.sidebar.collapsed .sidebar-footer span,
.sidebar.collapsed .nav-categories,
.sidebar.collapsed .nav-projects { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .sidebar-profile { justify-content: center; }

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

.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-logo-icon { font-size: 24px; }
.sidebar-logo-text { font-size: 17px; font-weight: 800; color: var(--accent); letter-spacing: -0.5px; }

.sidebar-toggle {
  background: none; border: none;
  color: var(--text-muted); font-size: 18px;
  padding: 6px; border-radius: 6px;
  transition: background var(--transition);
}
.sidebar-toggle:hover { background: var(--bg-hover); }

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}

.profile-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 700;
  flex-shrink: 0;
}

.profile-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.profile-role { font-size: 11px; color: var(--text-muted); }
.profile-menu-btn { background: none; border: none; color: var(--text-muted); font-size: 18px; margin-left: auto; padding: 4px; border-radius: 6px; }
.profile-menu-btn:hover { background: var(--bg-hover); }

.profile-menu {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 300;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}
.profile-menu a {
  display: block;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-primary);
  transition: background var(--transition);
}
.profile-menu a:hover { background: var(--bg-hover); }
.profile-menu a.danger { color: var(--danger); }
.profile-menu hr { border: none; border-top: 1px solid var(--border-color); }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.nav-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.nav-text { flex: 1; }
.nav-badge {
  background: var(--warning);
  color: var(--text-inverse);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  min-width: 22px;
  text-align: center;
}
.nav-badge.danger { background: var(--danger); color: #fff; }

.nav-categories, .nav-projects { padding: 2px 0; }
.nav-category-item, .nav-project-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition);
  margin-bottom: 1px;
}
.nav-category-item:hover, .nav-project-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-category-dot, .nav-project-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-add-btn {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  width: 100%;
  text-align: left;
  transition: all var(--transition);
}
.nav-add-btn:hover { background: var(--bg-hover); color: var(--accent); }

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

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 8px;
  border-radius: var(--radius-sm);
  width: 100%;
  transition: all var(--transition);
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

/* =================== MAIN CONTENT =================== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  transition: margin-left var(--transition);
  overflow-x: hidden;
}

.main-content.sidebar-collapsed { margin-left: 64px; }

/* =================== MOBILE HEADER =================== */
.mobile-header {
  display: none;
  align-items: center;
  padding: 0 16px;
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0; z-index: 100;
}

.mobile-menu-btn, .mobile-header-btn {
  background: none; border: none;
  color: var(--text-primary);
  font-size: 22px;
  padding: 8px;
  border-radius: 8px;
}
.mobile-menu-btn:hover, .mobile-header-btn:hover { background: var(--bg-hover); }
.mobile-header-title { flex: 1; text-align: center; font-size: 16px; font-weight: 700; }
.mobile-header-btn {
  width: 36px; height: 36px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 300;
}

/* =================== VIEWS =================== */
.view { display: none; padding: 24px; animation: fadeIn 0.25s ease; flex: 1; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.view-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.view-subtitle { color: var(--text-secondary); font-size: 14px; margin-top: 2px; }

/* =================== CARDS =================== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-sm); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-header h3 { font-size: 15px; font-weight: 700; }
.card-link { font-size: 13px; color: var(--accent); font-weight: 600; }

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

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform var(--transition), box-shadow var(--transition);
  animation: fadeIn 0.3s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }

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

.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -1px; }
.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; margin-top: 2px; }

/* =================== PROGRESS BAR =================== */
.progress-bar-wrapper { margin-bottom: 8px; }
.progress-bar-track {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #22c55e);
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* =================== DASHBOARD GRID =================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.chart-wrapper { position: relative; }

/* =================== TASK LIST =================== */
.task-list { display: flex; flex-direction: column; gap: 10px; }

.task-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: all var(--transition);
  cursor: pointer;
  animation: slideIn 0.2s ease;
  position: relative;
  overflow: hidden;
}
.task-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 99px 0 0 99px;
}
.task-card.priority-low::before { background: var(--priority-low); }
.task-card.priority-medium::before { background: var(--priority-medium); }
.task-card.priority-high::before { background: var(--priority-high); }
.task-card.priority-urgent::before { background: var(--priority-urgent); }

.task-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.task-card.done { opacity: 0.65; }
.task-card.done .task-title { text-decoration: line-through; color: var(--text-muted); }

.task-check {
  width: 22px; height: 22px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  margin-top: 1px;
  font-size: 12px;
}
.task-check:hover { border-color: var(--success); background: var(--success-light); }
.task-check.checked { background: var(--success); border-color: var(--success); color: #fff; }

.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 14px; font-weight: 600; color: var(--text-primary); line-height: 1.4; word-break: break-word; }
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
}
.task-date {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
}
.task-date.overdue { color: var(--danger); }
.task-date.today { color: var(--warning); }
.task-subtask-count { font-size: 11px; color: var(--text-muted); }

.task-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}
.task-card:hover .task-actions { opacity: 1; }

.task-action-btn {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 15px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all var(--transition);
}
.task-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.task-action-btn.delete:hover { background: var(--danger-light); color: var(--danger); }

/* =================== BADGES =================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 99px;
  line-height: 1;
}

.badge-pending { background: var(--bg-elevated); color: var(--text-secondary); }
.badge-in_progress { background: var(--accent-light); color: var(--accent); }
.badge-done { background: var(--success-light); color: var(--success); }
.badge-overdue { background: var(--danger-light); color: var(--danger); }

.badge-low { background: rgba(34,197,94,0.1); color: var(--priority-low); }
.badge-medium { background: rgba(245,158,11,0.1); color: var(--priority-medium); }
.badge-high { background: rgba(251,146,60,0.1); color: var(--priority-high); }
.badge-urgent { background: rgba(239,68,68,0.1); color: var(--priority-urgent); }

/* =================== FILTER BAR =================== */
.filter-bar { margin-bottom: 16px; }
.filter-search { margin-bottom: 10px; }
.search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  padding: 11px 16px;
  outline: none;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-select {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  padding: 8px 30px 8px 12px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.filter-select:focus { border-color: var(--accent); }

/* =================== EMPTY STATE =================== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 52px; margin-bottom: 12px; }
.empty-state-title { font-size: 18px; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-sub { font-size: 14px; }
.empty-state-btn { margin-top: 16px; }
.empty-state-mini { font-size: 13px; color: var(--text-muted); text-align: center; padding: 16px; }

/* =================== TASK LIST MINI =================== */
.task-list-mini { display: flex; flex-direction: column; gap: 8px; }
.task-mini-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: opacity var(--transition);
}
.task-mini-item:last-child { border-bottom: none; }
.task-mini-item:hover { opacity: 0.8; }
.task-mini-check {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
}
.task-mini-check.checked { background: var(--success); border-color: var(--success); color: #fff; }
.task-mini-title { flex: 1; font-size: 13px; font-weight: 500; }
.task-mini-date { font-size: 11px; color: var(--text-muted); }
.task-mini-date.overdue { color: var(--danger); }

/* =================== KANBAN =================== */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 280px);
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: 60vh;
}

.kanban-column {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 400px;
  max-height: calc(100dvh - 200px);
}

.kanban-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.kanban-col-dot { width: 10px; height: 10px; border-radius: 50%; }
.kanban-col-title { font-size: 13px; font-weight: 700; flex: 1; }
.kanban-col-count {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
}

.kanban-col-body {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100px;
}

.kanban-col-body.drag-over {
  background: var(--accent-light);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-sm);
}

.kanban-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: grab;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.kanban-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
.kanban-card.priority-low::before { background: var(--priority-low); }
.kanban-card.priority-medium::before { background: var(--priority-medium); }
.kanban-card.priority-high::before { background: var(--priority-high); }
.kanban-card.priority-urgent::before { background: var(--priority-urgent); }
.kanban-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.kanban-card.dragging { opacity: 0.5; cursor: grabbing; transform: rotate(2deg); }

.kanban-card-title { font-size: 13px; font-weight: 600; line-height: 1.4; margin-bottom: 8px; }
.kanban-card-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.kanban-card-date { font-size: 11px; color: var(--text-muted); }
.kanban-card-date.overdue { color: var(--danger); }

.kanban-add-btn {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 13px;
  padding: 10px 16px;
  text-align: left;
  width: 100%;
  border-top: 1px solid var(--border-light);
  transition: all var(--transition);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.kanban-add-btn:hover { background: var(--bg-hover); color: var(--accent); }

/* =================== CALENDAR =================== */
.calendar-grid {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.cal-week-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-color);
}

.cal-week-day {
  text-align: center;
  padding: 10px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.cal-day {
  min-height: 90px;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 6px;
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: var(--bg-hover); }
.cal-day.today { background: var(--accent-light); }
.cal-day.other-month { opacity: 0.4; }

.cal-day-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
}
.cal-day.today .cal-day-num {
  background: var(--accent);
  color: #fff;
}

.cal-task-dot {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border-radius: 4px;
  padding: 2px 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.cal-task-dot.overdue { color: var(--danger); background: var(--danger-light); }
.cal-task-dot.done { color: var(--success); background: var(--success-light); text-decoration: line-through; }
.cal-more { font-size: 10px; color: var(--accent); font-weight: 600; }

.calendar-day-tasks {
  margin-top: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  animation: slideIn 0.2s ease;
}
.cal-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cal-day-header h3 { font-size: 15px; font-weight: 700; }
.cal-day-header button { background: none; border: none; color: var(--text-muted); font-size: 18px; }

.cal-nav { display: flex; gap: 8px; }

/* =================== WEEK VIEW =================== */
.week-view { display: flex; flex-direction: column; gap: 12px; }
.week-day-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}
.week-day-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-light);
}
.week-day-label { font-size: 13px; font-weight: 700; }
.week-day-date { font-size: 12px; color: var(--text-muted); }
.week-day-count { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.week-day-body { padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.week-empty { font-size: 12px; color: var(--text-muted); padding: 8px; text-align: center; }

/* =================== MODAL =================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fadeIn 0.2s ease;
}

.modal-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 90dvh;
  overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
}

.modal-sm { max-width: 380px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 10;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  background: var(--bg-elevated);
  border: none;
  color: var(--text-muted);
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-surface);
  position: sticky;
  bottom: 0;
}

/* Task detail */
.task-detail-status-bar { display: flex; gap: 8px; }
.detail-title { font-size: 20px; font-weight: 700; margin-bottom: 12px; line-height: 1.4; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; font-size: 13px; color: var(--text-secondary); }
.detail-meta-item { display: flex; align-items: center; gap: 4px; }
.detail-description { font-size: 14px; color: var(--text-secondary); line-height: 1.7; background: var(--bg-elevated); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 16px; }
.detail-subtasks { margin-bottom: 16px; }
.detail-subtask-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.detail-subtask-item:last-child { border-bottom: none; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-tag { background: var(--accent-light); color: var(--accent); font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 99px; }

/* =================== SUBTASKS =================== */
.subtask-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.subtask-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
}
.subtask-check { cursor: pointer; }
.subtask-check.checked { text-decoration: line-through; color: var(--text-muted); }
.subtask-del { background: none; border: none; color: var(--text-muted); font-size: 14px; margin-left: auto; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.subtask-del:hover { background: var(--danger-light); color: var(--danger); }
.subtask-add-row { display: flex; gap: 8px; }
.subtask-input { flex: 1; }

/* =================== COLOR PICKER =================== */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.color-option {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  border: 3px solid transparent;
}
.color-option:hover { transform: scale(1.15); }
.color-option.selected { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--bg-surface); }

/* =================== SETTINGS =================== */
.settings-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}
.settings-section:last-child { border-bottom: none; margin-bottom: 0; }
.settings-section-title { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px; }
.settings-toggle-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 14px; }
.settings-btn-row { display: flex; gap: 8px; margin-bottom: 10px; }

/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 46px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg-elevated);
  border-radius: 99px;
  border: 1.5px solid var(--border-color);
  transition: background var(--transition);
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform var(--transition), background var(--transition);
}
input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
input:checked + .toggle-slider::before { transform: translate(22px, -50%); background: #fff; }

/* =================== BOTTOM NAV =================== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  z-index: 150;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  flex: 1;
}
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item:not(.bottom-nav-fab):hover { color: var(--accent); }
.bottom-nav-icon { font-size: 22px; }
.bottom-nav-label { font-size: 10px; }

.bottom-nav-fab {
  padding: 0;
  flex: 0 0 60px;
}
.bottom-nav-fab-btn {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 300;
  box-shadow: 0 4px 16px rgba(99,102,241,0.5);
  transition: transform var(--transition), box-shadow var(--transition);
  line-height: 1;
}
.bottom-nav-fab-btn:hover { transform: scale(1.1); box-shadow: 0 6px 24px rgba(99,102,241,0.6); }

/* =================== TOAST =================== */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  max-width: 300px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.3s ease;
  pointer-events: auto;
}
.toast.removing { animation: toastOut 0.3s ease forwards; }
.toast-success { border-color: var(--success); background: #0f2419; }
.toast-error { border-color: var(--danger); background: #2a0f0f; }
.toast-warning { border-color: var(--warning); background: #2a1f0f; }
[data-theme="light"] .toast-success { background: #f0fdf4; }
[data-theme="light"] .toast-error { background: #fef2f2; }
[data-theme="light"] .toast-warning { background: #fffbeb; }

/* =================== MOBILE SIDEBAR OVERLAY =================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 190;
  animation: fadeIn 0.2s ease;
}
.sidebar-overlay.visible { display: block; }

/* =================== RESPONSIVE TABLET =================== */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .kanban-board { grid-template-columns: repeat(2, 260px); }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 240px; }
  .kanban-board { grid-template-columns: repeat(2, 240px); }
}

/* =================== RESPONSIVE MOBILE =================== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px !important;
    z-index: 300;
  }
  .sidebar.mobile-open { transform: translateX(0); box-shadow: var(--shadow-lg); }

  .mobile-header { display: flex; }
  .main-content { margin-left: 0 !important; padding-top: 0; }
  .bottom-nav { display: flex; }

  .view { padding: 14px 12px 80px; }
  .view-header { margin-bottom: 16px; }
  .view-title { font-size: 22px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }

  .dashboard-grid { grid-template-columns: 1fr; }
  .kanban-board { grid-template-columns: repeat(2, 240px); }
  .form-row { grid-template-columns: 1fr; }

  .modal-panel { border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  .modal-sm { border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-width: 100%; }

  .toast-container { top: auto; bottom: 80px; right: 12px; left: 12px; }
  .toast { max-width: 100%; }

  .cal-task-dot { display: none; }
  .cal-day { min-height: 50px; }

  .filter-row { flex-wrap: wrap; }
  .filter-select { flex: 1 1 calc(50% - 4px); min-width: 130px; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; gap: 10px; }
  .stat-icon { width: 40px; height: 40px; font-size: 18px; }
  .stat-value { font-size: 20px; }
  .kanban-board { grid-template-columns: repeat(2, 200px); }
}
