/* ============================================================
   TaskMaster Pro - CSS Principal
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   VARIÁVEIS CSS - TEMA ESCURO (padrão)
   ============================================================ */
:root {
  /* Cores principais */
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --secondary: #ec4899;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  /* Fundo */
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #1e1e3a;
  --bg-card-hover: #252545;
  --bg-input: #252540;
  --bg-modal: #1a1a2e;
  --bg-overlay: rgba(0, 0, 0, 0.75);
  --bg-sidebar: #13132a;
  --bg-nav: #0f0f1a;

  /* Texto */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f0f1a;

  /* Bordas */
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-focus: #6366f1;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);

  /* Prioridades */
  --priority-low: #10b981;
  --priority-medium: #f59e0b;
  --priority-high: #f97316;
  --priority-urgent: #ef4444;

  /* Status */
  --status-pending: #64748b;
  --status-in-progress: #3b82f6;
  --status-completed: #10b981;
  --status-overdue: #ef4444;
  --status-cancelled: #6b7280;

  /* Dimensões */
  --sidebar-width: 260px;
  --nav-height: 60px;
  --bottom-nav-height: 64px;
  --border-radius: 12px;
  --border-radius-lg: 20px;
  --transition: all 0.2s ease;

  /* Gradientes */
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
  --gradient-secondary: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  --gradient-danger: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
  --gradient-bg: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #0f0f1a 100%);
}

/* ============================================================
   TEMA CLARO
   ============================================================ */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f1f5f9;
  --bg-modal: #ffffff;
  --bg-overlay: rgba(0, 0, 0, 0.5);
  --bg-sidebar: #ffffff;
  --bg-nav: #ffffff;

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

  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.16);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

  --gradient-bg: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #f8fafc 100%);
}

/* ============================================================
   RESET E BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

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

/* ============================================================
   TELA DE SPLASH
   ============================================================ */
#splash-screen {
  position: fixed;
  inset: 0;
  background: var(--gradient-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

#splash-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-logo {
  width: 100px;
  height: 100px;
  background: var(--gradient-primary);
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin-bottom: 24px;
  animation: splashPulse 1.5s ease-in-out infinite;
  box-shadow: var(--shadow-glow);
}

@keyframes splashPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(99,102,241,0.3); }
  50% { transform: scale(1.05); box-shadow: 0 0 40px rgba(99,102,241,0.6); }
}

.splash-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.splash-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 48px;
}

.splash-loader {
  width: 200px;
  height: 3px;
  background: var(--bg-card);
  border-radius: 99px;
  overflow: hidden;
}

.splash-loader-bar {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 99px;
  animation: loadingBar 1.5s ease forwards;
}

@keyframes loadingBar {
  from { width: 0%; }
  to { width: 100%; }
}

/* ============================================================
   TELA DE LOGIN / PERFIS
   ============================================================ */
#auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--gradient-bg);
}

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

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  width: 72px;
  height: 72px;
  background: var(--gradient-primary);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-glow);
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

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

/* Perfis na tela de login */
.profiles-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.profile-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-input);
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.profile-item:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-info {
  flex: 1;
}

.profile-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.profile-email {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================================
   FORMULÁRIOS
   ============================================================ */
.form-group {
  margin-bottom: 16px;
}

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

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

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

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

select.form-control {
  cursor: pointer;
  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;
  padding-right: 36px;
}

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

.input-group {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
}

.input-group .form-control {
  padding-left: 40px;
}

.input-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-size: 16px;
}

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--border-radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

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

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

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

.btn-secondary:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.btn-success {
  background: var(--gradient-success);
  color: white;
}

.btn-danger {
  background: var(--gradient-danger);
  color: white;
}

.btn-warning {
  background: var(--gradient-warning);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

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

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

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

.btn-icon-lg {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-lg {
  padding: 15px 28px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

.btn-fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 16px);
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  font-size: 24px;
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
  z-index: 100;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-fab:hover, .btn-fab:active {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.6);
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
#app {
  display: none;
  min-height: 100vh;
  background: var(--bg-primary);
}

#app.visible {
  display: flex;
  flex-direction: column;
}

/* Área de conteúdo */
.app-content {
  flex: 1;
  padding: 16px;
  padding-bottom: calc(var(--bottom-nav-height) + 16px);
  max-width: 768px;
  margin: 0 auto;
  width: 100%;
}

/* ============================================================
   HEADER DO APP
   ============================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 768px;
  margin: 0 auto;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  border: 2px solid var(--border);
  overflow: hidden;
}

.header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================================
   NAVEGAÇÃO INFERIOR
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-nav);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  height: 100%;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  transition: var(--transition);
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

.nav-item i {
  font-size: 20px;
  transition: var(--transition);
}

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

.nav-item.active i {
  transform: translateY(-2px);
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 14px);
  background: var(--danger);
  color: white;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.nav-item {
  position: relative;
}

/* ============================================================
   PÁGINAS / VIEWS
   ============================================================ */
.page {
  display: none;
  animation: fadeInUp 0.3s ease;
}

.page.active {
  display: block;
}

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

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  padding: 16px;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
}

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

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-greeting {
  margin-bottom: 20px;
}

.greeting-text {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.greeting-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 16px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
  cursor: pointer;
}

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

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Cores dos stat cards */
.stat-pending .stat-icon { background: rgba(100, 116, 139, 0.2); color: var(--status-pending); }
.stat-progress .stat-icon { background: rgba(59, 130, 246, 0.2); color: var(--status-in-progress); }
.stat-completed .stat-icon { background: rgba(16, 185, 129, 0.2); color: var(--status-completed); }
.stat-overdue .stat-icon { background: rgba(239, 68, 68, 0.2); color: var(--status-overdue); }
.stat-urgent .stat-icon { background: rgba(239, 68, 68, 0.15); color: var(--priority-urgent); }
.stat-today .stat-icon { background: rgba(99, 102, 241, 0.15); color: var(--primary); }

/* Barra de progresso */
.progress-section {
  margin-bottom: 20px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.progress-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.progress-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 99px;
  transition: width 0.5s ease;
}

/* ============================================================
   CARDS DE TAREFA
   ============================================================ */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid transparent;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}

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

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

.task-card.status-completed {
  opacity: 0.65;
}

.task-card.status-cancelled {
  opacity: 0.5;
}

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

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

.task-checkbox.checked {
  background: var(--success);
  border-color: var(--success);
  color: white;
  font-size: 11px;
}

.task-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  line-height: 1.4;
}

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

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

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

.task-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: var(--transition);
}

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

.task-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding-left: 30px;
}

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

.badge-priority-low { background: rgba(16, 185, 129, 0.15); color: var(--priority-low); }
.badge-priority-medium { background: rgba(245, 158, 11, 0.15); color: var(--priority-medium); }
.badge-priority-high { background: rgba(249, 115, 22, 0.15); color: var(--priority-high); }
.badge-priority-urgent { background: rgba(239, 68, 68, 0.15); color: var(--priority-urgent); }

.badge-status-pending { background: rgba(100, 116, 139, 0.15); color: var(--status-pending); }
.badge-status-in_progress { background: rgba(59, 130, 246, 0.15); color: var(--status-in-progress); }
.badge-status-completed { background: rgba(16, 185, 129, 0.15); color: var(--status-completed); }
.badge-status-overdue { background: rgba(239, 68, 68, 0.15); color: var(--status-overdue); }
.badge-status-cancelled { background: rgba(107, 114, 128, 0.15); color: var(--status-cancelled); }

.badge-category {
  background: var(--bg-input);
  color: var(--text-secondary);
}

.badge-date {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-light);
}

.badge-date.overdue {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.badge-tag {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

/* ============================================================
   MODAL / DRAWER
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(4px);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-modal);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 768px;
  max-height: 95vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding-bottom: env(safe-area-inset-bottom);
  border: 1px solid var(--border);
  border-bottom: none;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border-hover);
  border-radius: 99px;
  margin: 12px auto 0;
}

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

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: var(--bg-modal);
}

.modal-footer .btn {
  flex: 1;
}

/* Modal Centralizado (para tablet) */
@media (min-width: 600px) {
  .modal-overlay {
    align-items: center;
  }

  .modal {
    border-radius: 24px;
    max-height: 90vh;
    transform: scale(0.95) translateY(20px);
    border: 1px solid var(--border);
  }

  .modal-overlay.open .modal {
    transform: scale(1) translateY(0);
  }
}

/* ============================================================
   FILTROS / CHIPS
   ============================================================ */
.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.chip:hover, .chip.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary);
  color: var(--primary);
}

/* ============================================================
   BARRA DE BUSCA
   ============================================================ */
.search-bar {
  position: relative;
  margin-bottom: 16px;
}

.search-bar input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.search-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
}

/* ============================================================
   SEÇÕES
   ============================================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.section-link {
  font-size: 13px;
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
}

/* ============================================================
   CALENDÁRIO
   ============================================================ */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.calendar-month {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

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

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

.calendar-day-name {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 0;
  text-transform: uppercase;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.calendar-day:hover {
  background: var(--bg-input);
}

.calendar-day.today {
  background: var(--gradient-primary);
  color: white;
  font-weight: 700;
}

.calendar-day.selected {
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary);
  font-weight: 700;
}

.calendar-day.other-month {
  color: var(--text-muted);
  opacity: 0.4;
}

.calendar-day.has-tasks::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
}

.calendar-day.today.has-tasks::after {
  background: white;
}

/* ============================================================
   DETALHES DA TAREFA
   ============================================================ */
.task-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.task-detail-priority-bar {
  width: 4px;
  border-radius: 99px;
  align-self: stretch;
  flex-shrink: 0;
  min-height: 24px;
}

.task-detail-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.task-detail-section {
  margin-bottom: 20px;
}

.task-detail-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.task-detail-value {
  font-size: 14px;
  color: var(--text-primary);
}

/* Subtarefas */
.subtask-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-input);
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
}

.subtask-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid var(--border-hover);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: var(--transition);
}

.subtask-checkbox.checked {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.subtask-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
}

.subtask-text.done {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Tags */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ============================================================
   RELATÓRIOS
   ============================================================ */
.chart-container {
  position: relative;
  height: 220px;
  margin-bottom: 8px;
}

/* ============================================================
   CONFIGURAÇÕES
   ============================================================ */
.settings-section {
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0 4px;
  margin-bottom: 8px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 4px;
}

.settings-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.settings-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.settings-item-info {}

.settings-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-item-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-input);
  border-radius: 99px;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid var(--border);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
  background: var(--primary);
  border-color: var(--primary);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px) translateY(-50%);
  background: white;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-desc {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 260px;
  line-height: 1.6;
}

/* ============================================================
   TOAST / NOTIFICAÇÕES IN-APP
   ============================================================ */
#toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease forwards;
  pointer-events: all;
}

.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-error { border-left: 4px solid var(--danger); }
.toast.toast-warning { border-left: 4px solid var(--warning); }
.toast.toast-info { border-left: 4px solid var(--info); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast-icon { font-size: 18px; }
.toast-message { font-size: 13px; font-weight: 500; color: var(--text-primary); flex: 1; }

/* ============================================================
   CARREGAMENTO
   ============================================================ */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

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

/* ============================================================
   SEÇÃO DE CATEGORIA TAGS NO FORM
   ============================================================ */
.subtask-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.subtask-input-row .form-control {
  flex: 1;
}

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

/* ============================================================
   AGENDA - VIEW SELECTOR
   ============================================================ */
.view-selector {
  display: flex;
  gap: 6px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.view-btn {
  flex: 1;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-secondary);
  transition: var(--transition);
}

.view-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   PROFILE PICKER NO HEADER
   ============================================================ */
.profile-picker-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 8px;
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition);
}

.profile-picker-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ============================================================
   MISC
   ============================================================ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.text-muted { color: var(--text-muted); }
.text-primary-color { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.fw-bold { font-weight: 700; }
.fw-medium { font-weight: 500; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }

.overdue-indicator {
  color: var(--danger);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Scrollbar customizado */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Safe area */
.safe-area-bottom {
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

/* Animações */
.fade-in { animation: fadeIn 0.3s ease forwards; }
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.slide-up { animation: slideUp 0.3s ease forwards; }
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
