* { box-sizing: border-box; }

:root {
  --bg-body: #0b1120;
  --bg-shell: #020617;
  --bg-main: #0b1120;
  --bg-card: #020617;
  --border-soft: rgba(148, 163, 184, 0.25);
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --text-main: #f3f4f6;
  --text-soft: #9ca3af;
  --danger: #ef4444;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.75);
  --shadow-card: 0 18px 40px rgba(15, 23, 42, 0.85);
  --shadow-light: 0 10px 25px rgba(15, 23, 42, 0.7);
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #020617;
  color: var(--text-main);
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ========= LUZES DE NEON (BLOBS) NO FUNDO DE TELA DE LOGIN ========= */
.bg-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  filter: blur(130px);
  opacity: 0.18;
  mix-blend-mode: screen;
  transition: opacity 0.5s ease;
}
.blob-1 { top: -10%; left: -10%; background: #2563eb; }
.blob-2 { bottom: -10%; right: -10%; background: #7c3aed; }

/* Esconde as luzes coloridas de fundo se o usuário entrar no app ou usar tema claro */
#app-container:not(.hidden) ~ .bg-glow { display: none !important; }
.light-theme .bg-glow { opacity: 0.04 !important; }

/* ========= TELA DE CARREGAMENTO (LOADER) ========= */
.app-loader {
  position: fixed; inset: 0; background: var(--bg-shell);
  z-index: 9999; display: flex; align-items: center;
  justify-content: center; transition: opacity 0.3s ease;
}
.spinner {
  width: 45px; height: 45px; border: 4px solid rgba(59, 130, 246, 0.2);
  border-top-color: #3b82f6; border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========= NOVA INTERFACE DE LOGIN PREMIUM (GLASSMORPHISM) ========= */
.auth-container { 
  width: 100%; 
  min-height: 100vh; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  padding: 24px;
}
.auth-wrapper { width: 100%; max-width: 420px; }
.auth-card {
  background: rgba(15, 23, 42, 0.45); 
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 40px; 
  border-radius: 24px; 
  width: 100%; 
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08); 
  position: relative; 
}
.auth-header {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo {
  width: 75px;
  height: 75px;
  margin-bottom: 16px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(59, 130, 246, 0.3));
}
.auth-card h2 { 
  margin: 0; 
  font-size: 24px; 
  font-weight: 800; 
  color: #ffffff; 
  letter-spacing: -0.5px;
}
.auth-subtitle {
  margin: 6px 0 0 0;
  font-size: 14px;
  color: var(--text-soft);
  font-weight: 400;
}

/* INPUTS EVOLUÍDOS E MODERNOS */
.field { display: flex; flex-direction: column; margin-bottom: 18px; font-size: 14px; }
.field span { margin-bottom: 6px; color: #94a3b8; font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.field input, .field textarea, .field select {
  padding: 13px 16px; border-radius: 12px; border: 1px solid rgba(148, 163, 184, 0.3);
  background-color: rgba(15, 23, 42, 0.6); font-size: 15px; color: var(--text-main); font-family: inherit; transition: all 0.2s ease; width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--primary); 
  background: rgba(15, 23, 42, 0.9); 
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); 
  outline: none;
}

/* BOTÕES REESTRUTURADOS COM ANIMAÇÃO */
.btn { border: none; border-radius: 999px; padding: 10px 18px; font-size: 14px; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; transition: all 0.2s ease; }
.btn.primary { 
  width: 100%; 
  padding: 14px; 
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); 
  color: #ffffff; 
  font-size: 15px; 
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4); 
}
.btn.primary:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6); 
}
.btn.primary:active { transform: translateY(0); }

.btn.link { width: 100%; margin-top: 14px; padding: 8px; background: transparent; color: #93c5fd; font-size: 14px; font-weight: 500; }
.btn.link:hover { color: #ffffff; text-decoration: none; }
.error-msg { min-height: 18px; color: #fca5a5; font-size: 13px; text-align: center; margin-bottom: 8px; font-weight: 500; }

/* ========= APP PRINCIPAL E CABEÇALHO ========= */
.app-shell { min-height: 100vh; display: block; }
.app-main { width: 100%; display: flex; flex-direction: column; min-height: 100vh; }
.app-header { background: linear-gradient(90deg, #071633, #0a1f4d, #0d2f75); padding: 24px 40px; display: flex; justify-content: space-between; align-items: center; color: white; box-shadow: 0 4px 15px rgba(0,0,0,0.25); }
.app-header-left { display: flex; align-items: center; }
.header-title { display: flex; align-items: center; gap: 14px; }
.header-logo { width: 85px; height: 85px; border-radius: 14px; object-fit: contain; filter: drop-shadow(0 0 10px rgba(255,255,255,0.4)); }
.header-texts { display: flex; flex-direction: column; align-items: flex-start; }
.header-texts h1 { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 22px; font-weight: 800; color: #ffffff; }
.header-texts p { margin: 2px 0 0 0; color: rgba(255,255,255,0.8); font-size: 14px; font-weight: 400; }
.app-header-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }

/* ========= DESIGN DO PERFIL (GLASSMORPHISM) ========= */
.user-badge {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  background: rgba(30, 41, 59, 0.4) !important;
  padding: 6px 16px 6px 6px !important; 
  border-radius: 999px !important;
  border: 1px solid rgba(148, 163, 184, 0.2) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
  backdrop-filter: blur(12px) !important;
  transition: all 0.3s ease !important;
  cursor: default;
}
.user-badge:hover {
  background: rgba(30, 41, 59, 0.7) !important;
  border-color: rgba(59, 130, 246, 0.5) !important; 
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2) !important;
  transform: translateY(-1px);
}
.user-avatar {
  width: 38px !important;
  height: 38px !important;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
  border: 2px solid #ffffff !important; 
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.6) !important; 
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 800 !important;
  color: #fff !important;
  font-size: 16px !important;
  overflow: hidden !important;
}
.user-email { font-size: 14px !important; font-weight: 600 !important; color: #f8fafc !important; letter-spacing: 0.3px !important; }

/* ========= BOTÕES DO CABEÇALHO ========= */
.logout-btn { padding: 10px 22px; border-radius: 999px; background: #ef4444; color: white; border: none; font-weight: 600; cursor: pointer; transition: 0.2s; font-family: inherit; box-shadow: 0 0 12px rgba(239, 68, 68, 0.4); }
.logout-btn:hover { background: #dc2626; box-shadow: 0 0 16px rgba(239, 68, 68, 0.55); transform: translateY(-2px); }
.icon-btn { background: transparent !important; border: none !important; box-shadow: none !important; cursor: pointer; color: #e5e7eb; padding: 8px; border-radius: 8px; transition: 0.2s ease; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.1) !important; transform: scale(1.1); }
.content { padding: 18px 24px 24px; display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: 18px; min-height: 0; }

/* ========= CALENDÁRIO ========= */
.calendar-section { background: radial-gradient(circle at top left, rgba(30, 41, 59, 0.62), #020617 52%, #000 90%); border-radius: 24px; border: 1px solid rgba(55, 65, 81, 0.95); box-shadow: var(--shadow-card); padding: 16px 18px 18px; display: flex; flex-direction: column; min-height: 600px; }
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
#month-label { margin: 0; font-size: 20px; font-weight: 700; color: #f3f4f6; text-shadow: 0 0 8px rgba(59, 130, 246, 0.6); }
.nav-btn { width: 38px; height: 38px; border-radius: 999px; background: rgba(15, 23, 42, 0.9); border: 1px solid rgba(55, 65, 81, 0.65); color: #e5e7eb; cursor: pointer; font-size: 16px; transition: 0.18s ease; }
.nav-btn:hover { background: rgba(59, 130, 246, 0.4); border-color: rgba(59, 130, 246, 0.7); }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: #9ca3af; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 110px; gap: 6px; overflow: hidden; align-content: start; }
.calendar-day { background: rgba(15, 23, 42, 0.8); border-radius: 14px; padding: 6px 8px; min-height: 90px; border: 1px solid rgba(55, 65, 81, 0.7); cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; transition: 0.18s ease; }
.calendar-day:hover { background: rgba(59, 130, 246, 0.25); border-color: rgba(59, 130, 246, 0.7); }
.calendar-day.selected { background: rgba(59, 130, 246, 0.4); border-color: rgba(59, 130, 246, 1); transform: translateY(-2px); }
.calendar-day .day-number { font-size: 16px; font-weight: 600; color: #f3f4f6; }
.calendar-day .day-tasks-count { font-size: 12px; font-weight: 600; color: #93c5fd; padding: 2px 8px; background: rgba(30, 58, 138, 0.6); border-radius: 999px; }
.calendar-day .day-tasks-count.overdue { background: rgba(239, 68, 68, 0.25); color: #ef4444; font-weight: 700; box-shadow: 0 0 6px rgba(239, 68, 68, 0.6); }

/* ========= BUSCA INTELIGENTE ========= */
.search-container { position: relative; margin-bottom: 18px; display: flex; align-items: center; }
.search-container input { width: 100%; padding: 12px 16px; border-radius: 14px; border: 1px solid rgba(148, 163, 184, 0.5); background: rgba(15, 23, 42, 0.75); color: var(--text-main); font-family: inherit; font-size: 14px; transition: 0.2s; }
.search-container input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 8px rgba(59, 130, 246, 0.4); }
#clear-search { position: absolute; right: 14px; background: none; border: none; color: var(--text-soft); cursor: pointer; font-size: 16px; padding: 5px; }
#clear-search:hover { color: var(--danger); }

/* ========= TAREFAS ========= */
.tasks-section { background: radial-gradient(circle at top left, rgba(30, 41, 59, 0.62), #020617 55%, #000 95%); padding: 18px 18px 16px; border-radius: 24px; border: 1px solid rgba(55, 65, 81, 0.95); box-shadow: var(--shadow-card); display: flex; flex-direction: column; min-height: 600px; }
.tasks-section h3 { margin-top: 0; margin-bottom: 12px; font-size: 18px; font-weight: 700; color: #f9fafb; text-shadow: 0 0 8px rgba(59, 130, 246, 0.6); }
.task-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex: 1; border-top: 1px solid rgba(55, 65, 81, 0.65); padding-top: 10px; max-height: 420px; }
.task-item { border: 1px solid rgba(55, 65, 81, 0.7); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 10px; display: flex; justify-content: space-between; gap: 12px; align-items: center; background: rgba(15, 23, 42, 0.85); transition: 0.15s ease; }
.task-item:hover { background: rgba(59, 130, 246, 0.15); border-color: rgba(59, 130, 246, 0.6); transform: translateY(-2px); }
.task-item.done { background: rgba(34, 197, 94, 0.15); border-color: rgba(34, 197, 94, 0.6); opacity: 0.85; }
.task-item.overdue { background: rgba(239, 68, 68, 0.15); border-color: #ef4444; box-shadow: 0 0 12px rgba(239, 68, 68, 0.35); }
.task-title { font-weight: 600; font-size: 15px; color: #f3f4f6; margin-bottom: 6px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.task-item.overdue .task-title { color: #ef4444; }
.task-desc { font-size: 13px; color: #9ca3af; margin-bottom: 6px; }

/* ETIQUETAS DE PRIORIDADE */
.badge-priority { font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 700; display: inline-block; }
.priority-high { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4); }
.priority-medium { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.4); }
.priority-low { background: rgba(34, 197, 94, 0.15); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.4); }

.task-status { font-size: 12px; color: #6b7280; line-height: 1.6; }
.task-status strong { display: inline-block; background: rgba(59, 130, 246, 0.15); color: #60a5fa; padding: 2px 8px; border-radius: 6px; font-weight: 600; margin-bottom: 4px; border: 1px solid rgba(59, 130, 246, 0.3); }
.task-item.overdue .task-status strong { color: #fca5a5; background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.3); }
.task-actions { display: flex; flex-direction: column; gap: 7px; }
.task-actions .btn.small { display:flex; align-items:center; justify-content:center; padding: 8px 10px; font-size: 13px; border-radius: 10px; background: rgba(15, 23, 42, 0.9); border: 1px solid rgba(55, 65, 81, 0.8); color: #e5e7eb; transition: 0.18s ease; cursor: pointer; }
.task-actions .btn.small:hover { background: rgba(59, 130, 246, 0.35); border-color: rgba(59, 130, 246, 0.7); }
.task-form { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }

/* ========= DASHBOARD ADMIN ========= */
.dashboard-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 30px; }
.dash-card { background: var(--bg-card); padding: 24px; border-radius: 16px; box-shadow: var(--shadow-light); text-align: center; border: 1px solid rgba(148, 163, 184, 0.25); transition: transform 0.2s ease; }
.dash-card:hover { transform: translateY(-4px); }
.dash-card h3 { font-size: 36px; margin: 0 0 8px 0; color: var(--primary); }
.dash-card p { margin: 0; font-size: 14px; font-weight: 500; color: var(--text-soft); }

/* ========= FILTROS E PROGRESSO (AGENDA) ========= */
.task-stats { margin-bottom: 16px; display: flex; align-items: center; gap: 12px; }
.progress-bar { flex: 1; height: 8px; background: rgba(148, 163, 184, 0.2); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); width: 0%; transition: width 0.5s ease-out; }
#progress-text { font-size: 13px; font-weight: 700; color: var(--primary); min-width: 95px; text-align: right; }
.task-filters { display: flex; gap: 8px; margin-bottom: 20px; }
.filter-btn { background: transparent; border: 1px solid rgba(148, 163, 184, 0.4); color: var(--text-main); padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; cursor: pointer; transition: 0.2s; font-family: inherit; }
.filter-btn.active { background: rgba(59, 130, 246, 0.2); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.dev-credit { margin-top: 40px; padding: 20px 0; text-align: center; }
.dev-credit a { font-size: 13px; font-weight: 500; color: var(--text-soft); text-decoration: none; transition: 0.2s ease; }
.dev-credit a:hover { color: var(--primary); text-decoration: underline; }

@media (max-width: 960px) { .content { grid-template-columns: 1fr; } }
@media (max-width: 600px) { 
    .app-header { flex-direction: column; align-items: center; gap: 16px; } 
    .app-header-right { justify-content: center; width: 100%; }
}

/* ========================================= */
/* AJUSTES TEMA CLARO */
/* ========================================= */
.light-theme { background: #f8fafc; color: #374151; }
.light-theme body { background: #f8fafc; color: #374151; }
.light-theme h1, .light-theme h2, .light-theme h3 { color: #1e3a8a !important; }
.light-theme .header-texts h1 { color: #1d4ed8 !important; }
.light-theme .header-texts p { color: #3b82f6 !important; }
.light-theme .field span { color: #2563eb !important; font-weight: 600; }
.light-theme .weekdays div { color: #2563eb !important; }
.light-theme .day-number { color: #1e3a8a !important; }

.light-theme .auth-card { background: rgba(255, 255, 255, 0.8) !important; border-color: rgba(0,0,0,0.06); box-shadow: 0 20px 40px rgba(15, 23, 42, 0.06); }
.light-theme .auth-card h2 { color: #1e293b; }
.light-theme .auth-subtitle { color: #64748b; }
.light-theme .field span { color: #475569 !important; }
.light-theme .field input { background: #ffffff; border-color: #cbd5e1; color: #1e293b; }
.light-theme .field input:focus { background: #ffffff; border-color: #3b82f6; }
.light-theme .btn.link { color: #2563eb; }
.light-theme .btn.link:hover { color: #1d4ed8; }

.light-theme .app-header { background: #ffffff; border-bottom: 1px solid #e2e8f0; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
.light-theme .user-badge { background: #ffffff !important; border: 1px solid #e2e8f0 !important; box-shadow: 0 4px 10px rgba(15, 23, 42, 0.05) !important; }
.light-theme .user-badge:hover { border-color: #93c5fd !important; box-shadow: 0 4px 15px rgba(59, 130, 246, 0.15) !important; }
.light-theme .user-email { color: #1e293b !important; }
.light-theme .logout-btn { background: #dc2626; box-shadow: 0 0 10px rgba(220, 38, 38, 0.2); }
.light-theme .icon-btn { color: #475569 !important; }
.light-theme .icon-btn:hover { background: rgba(0, 0, 0, 0.05) !important; color: #1e293b !important; }
.light-theme .app-loader { background: #f8fafc; }
.light-theme .calendar-section, .light-theme .tasks-section { background: #ffffff; border-color: #e2e8f0; box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05); }
.light-theme .calendar-day { background: #f8fafc; border-color: #e2e8f0; }
.light-theme .calendar-day:hover { background: #eff6ff; border-color: #93c5fd; }
.light-theme .day-tasks-count { background: #dbeafe !important; color: #1d4ed8 !important; }
.light-theme .task-item { background: #ffffff; border-color: #e2e8f0; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.light-theme .task-item:hover { border-color: #93c5fd; background: #f8fafc; }
.light-theme .task-title { color: #1e3a8a !important; }
.light-theme .task-desc { color: #475569; }
.light-theme .search-container input { background: #f1f5f9; border-color: #cbd5e1; color: #1e293b; }
.light-theme .search-container input:focus { border-color: #3b82f6; box-shadow: 0 0 8px rgba(59, 130, 246, 0.2); }
.light-theme .task-status { color: #64748b; }
.light-theme .task-status strong { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.light-theme .task-item.done { background: #f0fdf4 !important; border-color: #86efac !important; opacity: 1 !important; }
.light-theme .task-item.done .task-title { color: #065f46 !important; text-decoration: line-through; }
.light-theme .task-item.done .task-desc { color: #047857 !important; }
.light-theme .task-actions .btn.small { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }
.light-theme .task-actions .btn.small:hover { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.light-theme .dash-card { background: #ffffff; border-color: #cbd5e1; }
.light-theme .filter-btn { color: #475569; border-color: #cbd5e1; }
.light-theme .filter-btn.active { background: #eff6ff; border-color: #3b82f6; color: #1d4ed8; }
.light-theme .priority-high { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.light-theme .priority-medium { background: #fef3c7; color: #d97706; border-color: #fde68a; }
.light-theme .priority-low { background: #dcfce3; color: #16a34a; border-color: #86efac; }

/* ========================================= */
/* CORREÇÃO DE DESEMPENHO PARA CELULAR (GPU) */
/* ========================================= */
@media (max-width: 768px) {
  /* Desativa os blobs gigantes que travam a tela preta no celular */
  .bg-glow {
    display: none !important;
  }
  
  /* Reduz a carga do efeito de vidro (Glassmorphism) no login para abrir rápido */
  .auth-card {
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
  }
}