/* ============================================================
   LUMEN – Design System
   Paleta: Azul Marinho · Branco · Cinza
   ============================================================ */

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

/* ─── Custom Properties ─────────────────────────────────── */
:root {
  --navy:        #0A1F44;
  --navy-light:  #122B5E;
  --navy-mid:    #1A3A6E;
  --blue:        #1A56DB;
  --blue-light:  #3B82F6;
  --blue-glow:   rgba(26,86,219,.18);
  --white:       #FFFFFF;
  --gray-50:     #F8FAFC;
  --gray-100:    #F1F5F9;
  --gray-200:    #E2E8F0;
  --gray-300:    #CBD5E1;
  --gray-400:    #94A3B8;
  --gray-500:    #64748B;
  --gray-600:    #475569;
  --gray-700:    #334155;
  --gray-800:    #1E293B;
  --green:       #10B981;
  --green-bg:    #ECFDF5;
  --yellow:      #F59E0B;
  --yellow-bg:   #FFFBEB;
  --red:         #EF4444;
  --red-bg:      #FEF2F2;

  --bg-page:     var(--gray-50);
  --bg-card:     var(--white);
  --bg-sidebar:  linear-gradient(180deg, var(--navy) 0%, var(--navy-light) 100%);
  --bg-topbar:   rgba(255,255,255,.9);
  --text-main:   var(--gray-800);
  --text-header: var(--navy);
  --text-muted:  var(--gray-500);
  --border-color: var(--gray-200);

  --sidebar-w:   258px;
  --topbar-h:    64px;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow:      0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.16);
  --transition:  .2s ease;
}

.dark-theme {
  --gray-50:     #0F172A;
  --gray-100:    #1E293B;
  --gray-200:    #334155;
  --gray-300:    #475569;
  --gray-400:    #64748B;
  --gray-500:    #94A3B8;
  --gray-700:    #E2E8F0;
  --gray-800:    #F8FAFC;
  --white:       #1E293B;
  --navy:        #020617;
  --navy-light:  #0F172A;
  --navy-mid:    #1E293B;
  
  --bg-page:     #020617;
  --bg-card:     #0F172A;
  --bg-sidebar:  #020617;
  --bg-topbar:   rgba(15,23,42,1); /* Fully opaque for sticky */
  --text-main:   #F8FAFC;
  --text-header: #F1F5F9;
  --text-muted:  #94A3B8;
  --border-color: #334155;
  --gray-600:    #94A3B8;
  
  --green-bg:    rgba(16,185,129,.15);
  --yellow-bg:   rgba(245,158,11,.15);
  --red-bg:      rgba(239,68,68,.15);
  
  --shadow-sm:   0 1px 3px rgba(0,0,0,.3);
  --shadow:      0 4px 16px rgba(0,0,0,.4);
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
#login-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 60%, #1e4080 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  animation: fadeIn .4s ease;
}
#login-screen.hidden { display: none; }

.login-card {
  background: rgba(255,255,255,.07);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
  animation: slideUp .45s cubic-bezier(.22,.68,0,1.2);
}
.login-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 32px;
}
.login-logo .logo-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--blue-light), var(--blue));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff;
  box-shadow: 0 4px 14px rgba(26,86,219,.5);
}
.login-logo .logo-text { color: #fff; }
.login-logo .logo-text span { display: block; }
.login-logo .logo-text .name { font-size: 1.15rem; font-weight: 700; letter-spacing: -.3px; }
.login-logo .logo-text .tagline { font-size: .72rem; font-weight: 400; opacity: .6; }
.login-card h2 { color: #fff; font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.login-card p { color: rgba(255,255,255,.55); font-size: .85rem; margin-bottom: 28px; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; color: rgba(255,255,255,.7); font-size: .78rem; font-weight: 500; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.login-field input {
  width: 100%; padding: 12px 16px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--radius-sm);
  color: #fff; font-size: .95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.login-field input::placeholder { color: rgba(255,255,255,.35); }
.login-field input:focus {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,.25);
}
.login-error {
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.35);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .82rem;
  margin-bottom: 16px;
  display: none;
}
.login-error.show { display: block; }
.btn-login {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--blue-light), var(--blue));
  color: #fff; font-size: .95rem; font-weight: 600;
  border-radius: var(--radius-sm);
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  box-shadow: 0 4px 14px rgba(26,86,219,.45);
  margin-top: 8px;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(26,86,219,.55); }
.btn-login:active { transform: translateY(0); }

/* ============================================================
   APP SHELL
   ============================================================ */
#app { display: none; }
#app.visible { display: flex; min-height: 100vh; }

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-sidebar);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  box-shadow: 4px 0 24px rgba(0,0,0,.25);
}
.sidebar-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 11px;
}
.sidebar-logo .logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--blue-light), var(--blue));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: #fff;
  box-shadow: 0 3px 10px rgba(26,86,219,.45);
  flex-shrink: 0;
}
.sidebar-logo .logo-title { color: #fff; font-weight: 700; font-size: 1rem; line-height: 1.2; }
.sidebar-logo .logo-sub { color: rgba(255,255,255,.45); font-size: .68rem; line-height: 1.3; }

.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-section-label {
  color: rgba(255,255,255,.35); font-size: .65rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  padding: 14px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.65); font-size: .875rem; font-weight: 500;
  transition: background var(--transition), color var(--transition);
  cursor: pointer; margin-bottom: 2px;
  user-select: none;
}
.nav-item .nav-icon { font-size: 1rem; flex-shrink: 0; width: 20px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(26,86,219,.35); color: #fff; font-weight: 600; }
.nav-item.active .nav-icon { color: var(--blue-light); }

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-badge {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,.06);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-light), var(--blue));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .85rem;
  flex-shrink: 0;
}
.user-info .user-name { color: #fff; font-size: .82rem; font-weight: 600; }
.user-info .user-role { color: rgba(255,255,255,.4); font-size: .7rem; }

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-logout {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 12px;
  color: rgba(255,255,255,.6); font-size: .85rem; font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  border: 1px solid transparent;
}
.btn-logout:hover { 
  background: rgba(239,68,68,.12); 
  color: #fca5a5;
  border-color: rgba(239,68,68,0.2);
}

.logo-img-login {
  width: 54px;
  height: 54px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(255,255,255,0.1));
}

.logo-img-sidebar {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

/* ─── Topbar ─────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0;
  left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: var(--bg-topbar);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: 1.05rem; font-weight: 700; color: var(--navy); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.btn-gcal {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border-radius: 99px;
  font-size: .78rem; font-weight: 600;
  transition: all var(--transition);
}
.btn-gcal.connected {
  background: var(--green-bg); color: var(--green);
  border: 1px solid rgba(16,185,129,.25);
}
.btn-gcal.disconnected {
  background: var(--gray-100); color: var(--gray-600);
  border: 1px solid var(--gray-200);
}
.btn-gcal:hover { filter: brightness(.95); }
.sidebar-toggle {
  display: none; padding: 8px; border-radius: var(--radius-sm);
  color: var(--gray-600); font-size: 1.2rem;
  transition: background var(--transition);
}
.sidebar-toggle:hover { background: var(--gray-100); }

/* ─── Main Content ───────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  flex: 1; min-height: 100vh;
}
.page { padding: 28px; animation: fadeIn .2s ease; }

/* ============================================================
   COMPONENTS
   ============================================================ */

/* ─── Page Header ────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-header-text h1 { font-size: 1.5rem; font-weight: 800; color: var(--text-header); }
.page-header-text p { color: var(--gray-500); font-size: .875rem; margin-top: 3px; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600;
  transition: all var(--transition);
}
.btn-primary {
  background: linear-gradient(135deg, var(--blue-light), var(--blue));
  color: #fff;
  box-shadow: 0 2px 8px rgba(26,86,219,.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(26,86,219,.4); }
.btn-secondary {
  background: var(--bg-card); color: var(--gray-700);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239,68,68,.2); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: .78rem; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); color: var(--gray-500); }
.btn-icon:hover { background: var(--gray-100); color: var(--gray-700); }

/* ─── Stat Cards ─────────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card-label { font-size: .75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-card-value { font-size: 2rem; font-weight: 800; color: var(--text-header); margin: 4px 0; line-height: 1; }
.stat-card-sub { font-size: .78rem; color: var(--text-muted); margin-top: 4px; border-top: 1px solid var(--gray-100); padding-top: 6px; }
.stat-card .stat-icon {
  float: right; margin-top: -4px;
  font-size: 1.5rem; opacity: .2;
}

/* ─── Dashboard Stats Groups ────────────────────────── */
.stats-section {
  margin-bottom: 32px;
}
.stats-section-title {
  font-size: .85rem; font-weight: 700; color: var(--navy);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
  opacity: 0.8;
}
.stats-section-title::after {
  content: ''; flex: 1; height: 1px; background: var(--gray-200);
}

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: .95rem; font-weight: 700; color: var(--text-header); }
.card-body { padding: 0; }

/* ─── Tables ─────────────────────────────────────────────── */
/* ─── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; width: 100%; border-radius: 8px; border: 1px solid var(--border-color); }
table { width: 100%; border-collapse: collapse; min-width: 900px; } /* Min-width prevents extreme squishing */
/* Base Table Headers */
thead th {
  padding: 14px 16px;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  background: var(--bg-card);
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

/* Main View Sticky Headers (Dashboard, Projects, etc) */
.table-wrap thead th,
.card-body thead th {
  position: sticky;
  top: var(--topbar-h);
  z-index: 20;
}
tbody td {
  padding: 12px 16px; font-size: .875rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main); vertical-align: middle;
}
tbody tr:hover { background: rgba(255,255,255,.02); }

/* Specific for Projects View Sticky Headers */
#view-projects .card { overflow: visible; }
#view-projects .table-wrap { overflow: visible; }

/* Sticky headers background and shadow */
#view-projects thead th {
  background: var(--bg-card);
  box-shadow: 0 2px 2px -1px rgba(0,0,0,0.05); /* Subtle shadow when sticking */
}
.group-header-row td {
  background: var(--gray-100) !important;
  color: var(--navy) !important;
  font-weight: 800;
  font-size: .8rem;
  padding: 16px 20px !important;
  border-top: 12px solid var(--bg-page) !important; /* Visual separation gap */
  border-bottom: 2px solid var(--border-color) !important;
}

.group-header-row.status-extrapolated td { background: #fee2e2 !important; color: #991b1b !important; border-bottom-color: #ef4444 !important; }
.group-header-row.status-alerta td { background: #fef3c7 !important; color: #92400e !important; border-bottom-color: #f59e0b !important; }
.group-header-row.status-em-dia td { background: #d1fae5 !important; color: #065f46 !important; border-bottom-color: #10b881 !important; }
.group-header-row.status-concluido td { background: #f1f5f9 !important; color: #475569 !important; border-bottom-color: #94a3b8 !important; }
.group-header-row.status-arquivado td { background: #f8fafc !important; color: #64748b !important; border-bottom-color: #cbd5e1 !important; }

/* Dark Mode overrides for groups */
[data-theme="dark"] .group-header-row.status-extrapolated td { background: rgba(239,68,68,.15) !important; color: #fca5a5 !important; }
[data-theme="dark"] .group-header-row.status-alerta td { background: rgba(245,158,11,.15) !important; color: #fcd34d !important; }
[data-theme="dark"] .group-header-row.status-em-dia td { background: rgba(16,185,129,.15) !important; color: #6ee7b7 !important; }
[data-theme="dark"] .group-header-row.status-concluido td { background: rgba(148,163,184,.15) !important; color: #cbd5e1 !important; }

.group-header-row:first-child td { border-top: none !important; }
.group-header-row:hover td { background: inherit !important; }

/* Refinements */
.client-highlight {
  color: var(--blue);
  font-weight: 700;
  font-size: 0.95rem;
}
.project-row-active {
  background: var(--blue-glow) !important;
  border-left: 4px solid var(--blue);
}
.project-row-active td {
  border-bottom: none;
}
[data-theme="dark"] .project-row-active {
  background: rgba(59,130,246,.1) !important;
}

/* Archiving UI */
.project-archived { opacity: 0.6; filter: grayscale(0.8); }
.btn-archive-active {
  background: var(--navy) !important;
  color: white !important;
  border-color: var(--navy) !important;
  box-shadow: 0 0 8px rgba(30,58,138,0.3);
}
.td-actions { display: flex; gap: 4px; }
.empty-state {
  padding: 48px 24px; text-align: center;
  color: var(--gray-400); font-size: .875rem;
}
.empty-state .empty-icon { font-size: 2.5rem; display: block; margin-bottom: 10px; }

/* ─── Status Badges ──────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 99px;
  font-size: .73rem; font-weight: 600; white-space: nowrap;
}
.badge-green  { background: var(--green-bg);  color: #059669; }
.badge-yellow { background: var(--yellow-bg); color: #B45309; }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-blue   { background: #EFF6FF; color: var(--blue); }
.badge-gray   { background: var(--gray-100);  color: var(--gray-500); }

/* Health Badges */
.badge-red-light { background: #FEF2F2; color: #DC2626; border: 1px solid rgba(220,38,38,0.2); }
.badge-green     { background: #ECFDF5; color: #059669; border: 1px solid rgba(16,185,129,0.2); }
.badge-yellow    { background: #FFFBEB; color: #D97706; border: 1px solid rgba(217,119,6,0.2); }
.badge-red       { background: #FEF2F2; color: #B91C1C; border: 1px solid rgba(185,28,28,0.2); }

/* Engagement Alerts Grid */
.engagement-alerts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.alert-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border-color);
  border-left: 5px solid var(--gray-300);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
}
.alert-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.health-yellow { border-left-color: var(--yellow); background: linear-gradient(90deg, var(--yellow-bg) 0%, var(--bg-card) 20%); }
.health-red    { border-left-color: var(--red); background: linear-gradient(90deg, var(--red-bg) 0%, var(--bg-card) 20%); }

.alert-info .alert-proj-name { font-weight: 700; color: var(--navy); font-size: 1.05rem; margin-top: 2px; }
.alert-info .alert-last { font-size: 0.75rem; color: var(--gray-400); margin-top: 4px; }

.alert-status {
  display: flex;
  align-items: center; justify-content: space-between;
  padding-top: 10px; border-top: 1px solid var(--gray-100);
}
.alert-days { font-size: 0.72rem; font-weight: 600; color: var(--gray-500); }

/* ─── Project Status ─────────────────────────────────────── */
.status-em-andamento { background: #EFF6FF; color: var(--blue); }
.status-pausado      { background: var(--yellow-bg); color: #B45309; }
.status-finalizado   { background: var(--gray-100);  color: var(--gray-500); }

/* ─── Progress Bar ───────────────────────────────────────── */
.progress-bar {
  height: 6px; background: var(--gray-100);
  border-radius: 99px; overflow: hidden; min-width: 80px;
}
.progress-fill {
  height: 100%; border-radius: 99px;
  transition: width .4s ease;
}
.progress-fill.ok     { background: linear-gradient(90deg, var(--blue-light), var(--blue)); }
.progress-fill.warn   { background: linear-gradient(90deg, #FCD34D, var(--yellow)); }
.progress-fill.danger { background: linear-gradient(90deg, #FCA5A5, var(--red)); }

/* ─── Dashboard Client Card ──────────────────────────────── */
.client-section { margin-bottom: 28px; }
.client-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.client-section-header h3 { font-size: 1rem; font-weight: 700; color: var(--text-header); }
.project-row-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 16px; align-items: center;
  transition: box-shadow var(--transition);
}
.project-row-card:hover { box-shadow: var(--shadow); }
.project-row-card .proj-name { font-weight: 600; color: var(--navy); font-size: .88rem; }
.project-row-card .proj-type { font-size: .75rem; color: var(--gray-400); margin-top: 2px; }
.proj-hours { text-align: right; }
.proj-hours .val { font-weight: 700; font-size: 1rem; }
.proj-hours .lbl { font-size: .68rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: .4px; }
.client-summary {
  background: var(--navy);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  display: flex; gap: 24px;
  margin-bottom: 16px;
}
.client-summary .cs-item .cs-val { color: #fff; font-weight: 700; font-size: 1.1rem; }
.client-summary .cs-item .cs-lbl { color: rgba(255,255,255,.45); font-size: .68rem; text-transform: uppercase; letter-spacing: .5px; }

/* ─── Critical View ──────────────────────────────────────── */
.critical-item {
  background: var(--white);
  border: 1px solid rgba(239,68,68,.2);
  border-left: 4px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
}
.critical-item .ci-name { font-weight: 700; color: var(--navy); }
.critical-item .ci-client { font-size: .78rem; color: var(--gray-400); }
.critical-saldo { text-align: right; }
.critical-saldo .val { font-size: 1.4rem; font-weight: 800; color: var(--red); }
.critical-saldo .lbl { font-size: .68rem; color: var(--gray-400); }

/* ─── Quick Entry (Mobile Panel) ─────────────────────────── */
.quick-entry-wrap {
  max-width: 520px; margin: 0 auto;
}
.quick-entry-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.quick-entry-header {
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  padding: 24px; color: #fff;
}
.quick-entry-header h2 { font-size: 1.2rem; font-weight: 700; }
.quick-entry-header p { font-size: .82rem; opacity: .6; margin-top: 4px; }
.quick-entry-body { padding: 24px; }

/* ─── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: .78rem; font-weight: 600;
  color: var(--gray-600); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px;
}
.form-control {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .9rem; color: var(--gray-800);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.form-control::placeholder { color: var(--gray-300); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-hint { font-size: .75rem; color: var(--gray-400); margin-top: 4px; }

/* ─── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,31,68,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
}
.modal-overlay.open { display: flex; animation: fadeIn .2s ease; }
.modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp .25s cubic-bezier(.22,.68,0,1.15);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; color: var(--navy); }
.modal-close { padding: 6px; border-radius: var(--radius-sm); color: var(--gray-400); font-size: 1.1rem; }
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ─── Settings ───────────────────────────────────────────── */
.settings-section {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  padding: 24px; margin-bottom: 20px;
}
.settings-section h3 {
  font-size: 1rem; font-weight: 700; color: var(--navy);
  margin-bottom: 4px;
}
.settings-section .section-desc { font-size: .82rem; color: var(--gray-400); margin-bottom: 20px; }
.settings-section hr { border: none; border-top: 1px solid var(--gray-100); margin: 20px 0; }

/* ─── Alerts / Toast ─────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--navy);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  display: flex; align-items: center; gap: 10px;
  transform: translateY(80px); opacity: 0;
  transition: all .3s cubic-bezier(.22,.68,0,1.2);
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

/* ─── Overlays & Misc ────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; background: rgba(10,31,68,.4);
  z-index: 99; display: none;
}
.overlay.show { display: block; }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 20px 0; }
.text-muted { color: var(--gray-400); font-size: .82rem; }
.no-items { text-align: center; padding: 36px; color: var(--gray-300); font-size: 2rem; }

/* ─── Calendar View ────────────────────────────────────────── */
.calendar-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.calendar-nav { display: flex; align-items: center; gap: 12px; }
.calendar-nav h2 { font-size: 1.25rem; font-weight: 700; color: var(--navy); min-width: 160px; text-align: center; }
.calendar-grid-main {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 1px; background: var(--border-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius); overflow: hidden;
}
.calendar-day-header {
  background: var(--gray-50); padding: 10px;
  text-align: center; font-size: .75rem; font-weight: 700;
  color: var(--gray-500); text-transform: uppercase;
}
.calendar-day {
  background: var(--bg-card); min-height: 110px;
  padding: 8px; transition: background var(--transition);
}
.calendar-day:hover { background: var(--gray-50); }
.calendar-day.other-month { background: #fafafa; opacity: 0.6; }
.calendar-day.today .day-number {
  background: var(--blue); color: #fff; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-weight: 700;
}
.day-number {
  font-size: .85rem; font-weight: 600; color: var(--gray-600);
  margin-bottom: 6px; display: inline-block;
}
.cal-event-chip {
  padding: 4px 6px; border-radius: 4px; font-size: .7rem; font-weight: 600;
  margin-bottom: 4px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: transform 0.1s; border-left: 3px solid transparent;
}
.cal-event-chip:hover { transform: translateY(-1px); filter: brightness(.95); }
.cal-event-aguardando { background: #FFF7ED; color: #C2410C; border-left-color: #F97316; }
.cal-event-realizado  { background: #ECFDF5; color: #047857; border-left-color: #10B981; }
.cal-event-cancelado  { background: #FEF2F2; color: #B91C1C; border-left-color: #EF4444; }

/* ─── Calendar View Toggles ──────────────────────────────── */
.calendar-view-toggles { display: flex; background: var(--gray-100); border-radius: var(--radius-sm); padding: 4px; gap: 4px; }
.cal-view-btn { padding: 6px 12px; font-size: .75rem; font-weight: 600; color: var(--gray-500); border-radius: 6px; }
.cal-view-btn.active { background: var(--white); color: var(--navy); box-shadow: var(--shadow-sm); }

/* ─── Calendar Day & Week Grids ──────────────────────────── */
.calendar-grid-main.week { grid-template-columns: repeat(7, 1fr); }
.calendar-grid-main.day { grid-template-columns: 1fr; }
.calendar-day-large { min-height: 400px; padding: 16px; }
.calendar-day-large .cal-event-chip { padding: 8px 12px; font-size: .85rem; margin-bottom: 8px; white-space: normal; }

/* ─── Client Details Panel & Accordions ──────────────────── */
.client-details-panel {
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-top: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 20px; margin-top: -8px; margin-bottom: 24px;
  display: none; animation: slideDown 0.3s ease;
}
.client-details-panel.open { display: block; }
.cd-section-title { font-size: .85rem; font-weight: 700; color: var(--navy); margin-bottom: 12px; text-transform: uppercase; }

/* ─── Project Accordion (Time Records) ───────────────────── */
.project-accordion-body {
  background: var(--gray-100);
  padding: 24px 32px;
  border-bottom: 1px solid var(--gray-300);
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.08); /* Inner shadow for depth */
  display: none; animation: slideDown 0.2s ease;
}
[data-theme="dark"] .project-accordion-body {
  background: #020617;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.4);
}
.project-accordion-body.open { display: block; }

.accordion-toggle-btn { transition: transform 0.2s; }
.accordion-toggle-btn.open { transform: rotate(180deg); }

.embedded-table { 
  margin-top: 16px; 
  background: var(--bg-card); 
  border-radius: var(--radius-sm); 
  overflow: hidden; 
  border: 2px solid var(--navy-mid); /* Stronger border */
  box-shadow: var(--shadow); /* Depth for the table */
}
.embedded-table table { background: var(--bg-card); border: none; }
.embedded-table thead th { 
  position: static !important; /* Never sticky */
  background: var(--navy) !important;
  color: #fff !important; 
  font-size: .65rem; 
  border-bottom: 1px solid var(--navy-mid) !important;
}
.embedded-table tbody tr:hover { background: var(--blue-glow); }
[data-theme="dark"] .embedded-table tbody tr:hover { background: rgba(59,130,246,0.1); }

/* ─── Animations ─────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Mobile Overlay Sidebar ─────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .overlay { z-index: 150; }
  .topbar { left: 0; }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .project-row-card { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .client-summary { flex-wrap: wrap; gap: 12px; }
  .page { padding: 16px; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 480px) {
  .project-row-card { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
  .calendar-nav h2 { font-size: 1rem; min-width: 120px; }
  .calendar-day { padding: 4px; min-height: 80px; }
  .cal-event-chip { padding: 3px 4px; font-size: .65rem; }
}

/* ─── Dashboard Charts ───────────────────────────────────── */
.charts-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 8px;
}
.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
}
.charts-row.full-width {
  grid-template-columns: 1fr;
}
.chart-card {
  padding: 0;
  display: flex;
  flex-direction: column;
}
.chart-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}
.chart-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-header);
}
.chart-body {
  padding: 20px;
  flex: 1;
  position: relative;
  min-height: 250px;
}

@media (max-width: 768px) {
  .charts-row {
    grid-template-columns: 1fr;
  }
}
/* ─── AI Chat Widget ────────────────────────────────────── */
.ai-fab {
  position: fixed; bottom: 30px; right: 30px;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--navy); color: white; border: none;
  box-shadow: 0 4px 15px rgba(10,31,68,.3);
  cursor: pointer; z-index: 10001;
  display: flex; align-items: center; justify-content: center;
  transition: all .3s cubic-bezier(.22,.68,0,1.2);
}
.ai-fab:hover { transform: scale(1.1) rotate(5deg); box-shadow: 0 6px 20px rgba(10,31,68,.4); }
.ai-fab-icon { font-size: 1.8rem; }

#ai-chat-widget {
  position: fixed; bottom: 100px; right: 30px;
  width: 380px; height: 500px; max-height: calc(100vh - 150px);
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 10000; display: flex; flex-direction: column;
  overflow: hidden; transition: all .4s cubic-bezier(.22,.68,0,1);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.ai-chat-closed { opacity: 0; pointer-events: none; transform: translateY(30px) scale(0.95); }

.ai-chat-header {
  padding: 16px 20px; background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  color: white; display: flex; align-items: center; justify-content: space-between;
}
.ai-chat-body {
  flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
  background: rgba(255,255,255,0.02);
}
.ai-chat-footer {
  padding: 15px; border-top: 1px solid var(--border-color);
  display: flex; gap: 10px; align-items: flex-end;
}
.ai-chat-footer textarea {
  flex: 1; border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  padding: 10px; font-size: .85rem; resize: none; height: 40px; min-height: 40px; max-height: 120px;
  outline: none; transition: border-color .3s;
}
.ai-chat-footer textarea:focus { border-color: var(--blue); }

.chat-msg {
  max-width: 85%; padding: 10px 14px; border-radius: 15px; font-size: .85rem; line-height: 1.4;
}
.msg-ai { align-self: flex-start; background: var(--gray-100); color: var(--text-main); border-bottom-left-radius: 2px; }
.msg-user { align-self: flex-end; background: var(--blue); color: white; border-bottom-right-radius: 2px; }
.msg-loading { align-self: flex-start; color: var(--text-muted); font-style: italic; display: flex; gap: 5px; }

/* ─── Switch / Toggle ─────────────────────────── */
/* ─── Switch / Toggle ─────────────────────────── */
.switch-wrap {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  gap: 12px;
  line-height: 1;
}
.switch-wrap input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  width: 44px;
  height: 22px;
  background: var(--gray-300);
  border-radius: 22px;
  position: relative;
  transition: background 0.30s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  border: 1px solid var(--gray-200);
}
.switch-slider::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.switch-wrap input:checked + .switch-slider {
  background: var(--blue);
  border-color: var(--blue);
}
.switch-wrap input:checked + .switch-slider::after {
  transform: translateX(22px);
}
.switch-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

@media (max-width: 480px) {
  #ai-chat-widget { right: 10px; left: 10px; width: auto; bottom: 90px; }
}

/* ============================================================
   UPDATES TIMELINE
   ============================================================ */

/* Filters bar */
.updates-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  align-items: center;
}

/* Outer timeline wrapper */
.updates-timeline {
  max-width: 900px;
}

.timeline-wrapper {
  position: relative;
}

/* Day group */
.timeline-day-group {
  margin-bottom: 32px;
}

.timeline-day-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: capitalize;
  letter-spacing: .4px;
  margin-bottom: 16px;
  padding: 6px 14px;
  background: var(--gray-100);
  border-radius: 99px;
  display: inline-block;
  border: 1px solid var(--border-color);
}

/* Single timeline entry */
.timeline-entry {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 0 16px;
  margin-bottom: 14px;
  position: relative;
}

/* The vertical line connecting entries */
.timeline-entry::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 42px;
  bottom: -14px;
  width: 2px;
  background: var(--border-color);
}
.timeline-entry:last-child::before { display: none; }

/* Dot/icon */
.timeline-dot {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

/* Card */
.timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.timeline-card:hover {
  transform: translateX(2px);
  box-shadow: var(--shadow);
}

.timeline-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.timeline-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-header);
}

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

.timeline-time {
  font-size: .75rem;
  font-weight: 600;
  color: var(--gray-400);
  white-space: nowrap;
}

.timeline-author {
  font-size: .75rem;
  color: var(--gray-500);
  white-space: nowrap;
}

.timeline-desc {
  font-size: .875rem;
  color: var(--gray-600);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Badge additions */
.badge-navy {
  background: rgba(10,31,68,.08);
  color: var(--navy);
  border: 1px solid rgba(10,31,68,.15);
}
.dark-theme .badge-navy {
  background: rgba(255,255,255,.08);
  color: var(--blue-light);
  border-color: rgba(255,255,255,.12);
}

/* Dark mode timeline tweaks */
.dark-theme .timeline-day-label {
  background: var(--gray-100);
  color: var(--gray-500);
}
.dark-theme .timeline-entry::before {
  background: var(--border-color);
}

/* Responsive */
@media (max-width: 600px) {
  .timeline-entry { grid-template-columns: 32px 1fr; }
  .timeline-dot { width: 32px; height: 32px; font-size: .85rem; }
  .timeline-entry::before { left: 15px; }
  .timeline-card-header { flex-direction: column; gap: 8px; }
  .updates-filters { flex-direction: column; }
}

/* ============================================================
   PROJECT NOTES (inline in accordion)
   ============================================================ */

.proj-notes-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-color);
}

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

.proj-notes-title {
  font-size: .82rem;
  color: var(--navy);
  font-weight: 700;
}

.proj-notes-empty {
  font-size: .78rem;
  color: var(--gray-400);
  text-align: center;
  padding: 12px 0 4px;
  font-style: italic;
}

.proj-notes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Individual note row */
.proj-note-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 0 10px;
  align-items: flex-start;
  background: var(--gray-50);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: background var(--transition);
}
.proj-note-item:hover { background: var(--bg-card); }

.proj-note-left { padding-top: 2px; }

.proj-note-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
}

.proj-note-body { flex: 1; }

.proj-note-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.proj-note-type {
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
}

.proj-note-datetime,
.proj-note-author {
  font-size: .68rem;
  color: var(--gray-400);
}

.proj-note-text {
  font-size: .8rem;
  color: var(--gray-700);
  line-height: 1.5;
  white-space: pre-wrap;
}

.proj-note-actions {
  display: flex;
  gap: 4px;
  align-items: flex-start;
  padding-top: 2px;
}

/* Note type color variants (dot background + type label) */
.note-badge-green  { background: var(--green-bg); color: #059669; }
.note-badge-yellow { background: var(--yellow-bg); color: #B45309; }
.note-badge-red    { background: var(--red-bg); color: var(--red); }
.note-badge-blue   { background: #EFF6FF; color: var(--blue); }
.note-badge-gray   { background: var(--gray-100); color: var(--gray-500); }

/* ============================================================
   TASKS MODULE
   ============================================================ */
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--red); color: #fff;
  font-size: .6rem; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 99px;
  padding: 0 4px; margin-left: auto;
}
.tasks-filters {
  display: flex; gap: 12px; flex-wrap: wrap;
  align-items: center; margin-bottom: 20px;
}
.tasks-list { 
  display: grid; 
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); 
  gap: 20px; 
  width: 100%; 
}

.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.04);
  display: flex; flex-direction: column; overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  position: relative;
}
.task-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.task-card.task-archived { opacity: .6; filter: grayscale(.8); }
.task-card-priority-bar { height: 5px; width: 100%; flex-shrink: 0; }
.task-card-main { flex: 1; padding: 20px 24px; display: flex; flex-direction: column; }

.task-card-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.task-card-title-row { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.task-title { font-size: 1.1rem; font-weight: 800; color: var(--navy); line-height: 1.3; }
.task-badges-row { display: flex; flex-wrap: wrap; gap: 6px; }

.task-card-actions {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 16px; margin-top: auto;
  border-top: 1px solid var(--gray-100);
}
.task-card-actions-left { display: flex; gap: 8px; align-items: center; }
.task-card-actions-right { display: flex; gap: 6px; align-items: center; }

.task-card-meta {
  display: flex; flex-direction: column; gap: 8px;
  font-size: .8rem; margin-bottom: 16px;
}
.task-due { display: flex; align-items: center; gap: 6px; color: var(--gray-500); font-weight: 500; font-size: .85rem; }
.task-due.overdue { color: var(--red); font-weight: 700; }
.task-links { display: flex; flex-wrap: wrap; gap: 8px; }
.task-link-badge {
  background: var(--gray-50); color: var(--gray-600);
  font-size: .72rem; font-weight: 600;
  padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--border-color);
}
.task-desc { font-size: .85rem; color: var(--gray-600); line-height: 1.6; margin-bottom: 16px; }
.task-latest-update {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: .8rem; padding: 12px;
  background: var(--gray-50);
  border-left: 3px solid var(--gray-300);
  border-radius: 0 6px 6px 0; margin-bottom: 16px;
  color: var(--gray-700);
}

.task-badge {
  font-size: .68rem; font-weight: 700;
  padding: 2px 9px; border-radius: 99px; white-space: nowrap;
}
.task-badge-alta   { background: var(--red-bg);    color: var(--red); }
.task-badge-normal { background: var(--yellow-bg); color: #B45309; }
.task-badge-baixa  { background: var(--green-bg);  color: #059669; }
.task-status-pendente   { background: #FEF3C7; color: #92400E; }
.task-status-andamento  { background: #EFF6FF; color: var(--blue); }
.task-status-concluida  { background: #ECFDF5; color: #065F46; }
.task-status-arquivada  { background: var(--gray-100); color: var(--gray-500); }

.task-overdue-badge {
  font-size: .68rem; font-weight: 700; padding: 2px 9px; border-radius: 99px;
  background: var(--red-bg); color: var(--red); animation: pulse 1.5s infinite;
}
.task-urgent-badge {
  font-size: .68rem; font-weight: 700; padding: 2px 9px; border-radius: 99px;
  background: var(--yellow-bg); color: #92400E;
}

.task-expand-btn { transition: transform var(--transition); }
.task-expand-btn.open { transform: rotate(180deg); }

.task-updates-accordion {
  border-top: 1px dashed var(--border-color);
  max-height: 0; overflow: hidden;
  transition: max-height .3s ease;
}
.task-updates-accordion.open { max-height: 1000px; }
.task-updates-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px 8px;
  font-size: .8rem; font-weight: 700; color: var(--navy);
  background: var(--gray-50);
}
.task-updates-body { padding: 10px 18px 14px; display: flex; flex-direction: column; gap: 8px; }
.task-update-item {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--gray-50); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); padding: 8px 10px;
}
.task-no-updates {
  font-size: .78rem; color: var(--gray-400);
  text-align: center; font-style: italic; padding: 8px 0;
}

/* Progress Bar Timeline */
.task-progress-container {
  width: 100%; height: 6px; background: var(--gray-200);
  border-radius: 4px; margin: 12px 0 8px 0; overflow: hidden;
}
.dark-theme .task-progress-container { background: var(--gray-100); }
.task-progress-bar {
  height: 100%; border-radius: 4px;
  transition: width 0.3s ease, background 0.3s ease;
}

/* Reminder Overlay */
.reminder-overlay {
  position: fixed; inset: 0;
  background: rgba(10,31,68,.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  z-index: 9990;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .3s ease;
}
.reminder-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 32px 36px; max-width: 440px; width: 90%;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 16px;
  align-items: center; text-align: center;
  animation: slideUp .3s cubic-bezier(.22,.68,0,1.2);
  border-top: 5px solid var(--yellow);
}
.reminder-icon { font-size: 3rem; animation: pulse 1.2s infinite; }
.reminder-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--gray-400); }
.reminder-task-title { font-size: 1.15rem; font-weight: 800; color: var(--text-header); margin-top: 2px; }
.reminder-task-due { font-size: .82rem; color: var(--gray-500); }
.reminder-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

.dark-theme .task-updates-header { background: var(--gray-100); }
.dark-theme .task-update-item    { background: var(--gray-100); }

@media (max-width: 680px) {
  .task-card-header { flex-direction: column; }
  .tasks-filters { flex-direction: column; }
  .reminder-card { padding: 24px 20px; }
}
