:root {
  --bg: #f8f9fb;
  --surface: #ffffff;
  --surface-2: #f1f3f7;
  --text: #111827;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --primary: #1a56db;
  --primary-light: #e8effc;
  --accent: #0891b2;
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --border: #e5e7eb;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Plus Jakarta Sans', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* LOGIN */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1a56db 100%); position: relative; overflow: hidden; }
.login-page::before { content: ''; position: absolute; width: 600px; height: 600px; background: radial-gradient(circle, rgba(8,145,178,0.15) 0%, transparent 70%); top: -200px; right: -200px; }
.login-page::after { content: ''; position: absolute; width: 400px; height: 400px; background: radial-gradient(circle, rgba(26,86,219,0.2) 0%, transparent 70%); bottom: -100px; left: -100px; }
.login-card { background: rgba(255,255,255,0.05); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.1); border-radius: 20px; padding: 48px 40px; width: 420px; max-width: 90vw; position: relative; z-index: 1; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 32px; font-weight: 800; color: white; letter-spacing: -1px; }
.login-logo p { color: rgba(255,255,255,0.6); font-size: 14px; margin-top: 4px; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; color: rgba(255,255,255,0.7); font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.login-field input { width: 100%; padding: 14px 16px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); border-radius: 12px; color: white; font-size: 15px; font-family: inherit; outline: none; transition: all 0.2s; }
.login-field input::placeholder { color: rgba(255,255,255,0.3); }
.login-field input:focus { border-color: var(--accent); background: rgba(255,255,255,0.12); }
.login-btn { width: 100%; padding: 16px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; border: none; border-radius: 12px; font-size: 16px; font-weight: 700; cursor: pointer; transition: all 0.3s; margin-top: 8px; font-family: inherit; }
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(26,86,219,0.4); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.login-error { color: #fca5a5; font-size: 13px; text-align: center; margin-top: 12px; display: none; }
.login-info { color: rgba(255,255,255,0.4); font-size: 11px; text-align: center; margin-top: 16px; }

/* APP */
.app { display: none; }
.app.active { display: block; }
.app-header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.app-header h2 { font-size: 18px; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }
.app-header-user { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.app-header-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.logout-btn { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 12px; font-weight: 600; font-family: inherit; padding: 4px 8px; border-radius: 6px; }
.logout-btn:hover { background: var(--danger-light); }
.app-content { max-width: 1000px; margin: 0 auto; padding: 24px 16px 100px; }

/* PAGES */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* NAV */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); display: flex; justify-content: space-around; padding: 8px 0 12px; z-index: 100; }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; padding: 4px 12px; border-radius: 10px; transition: all 0.2s; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active .nav-icon, .nav-item.active .nav-label { color: var(--primary); }
.nav-item.active .nav-label { font-weight: 700; }
.nav-icon { font-size: 20px; color: var(--text-3); }
.nav-label { font-size: 10px; color: var(--text-3); font-weight: 600; }

/* CARDS */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-link { font-size: 12px; color: var(--primary); text-decoration: none; font-weight: 600; margin-left: auto; cursor: pointer; }

/* PROFILE */
.profile-card { background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 60%, #1a56db 100%); border-radius: var(--radius); padding: 28px 24px; color: white; margin-bottom: 16px; box-shadow: 0 4px 20px rgba(26,86,219,0.25); }
.profile-row { display: flex; align-items: center; gap: 20px; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; background: rgba(255,255,255,0.15); border: 3px solid rgba(255,255,255,0.25); display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; flex-shrink: 0; }
.profile-name { font-size: 20px; font-weight: 800; }
.profile-cargo { font-size: 13px; opacity: 0.75; margin-top: 2px; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.12); }
.profile-meta-item { font-size: 12px; opacity: 0.8; display: flex; align-items: center; gap: 5px; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; text-align: center; cursor: pointer; transition: all 0.2s; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; margin-bottom: 8px; letter-spacing: 0.5px; }
.stat-value { font-size: 36px; font-weight: 800; color: var(--text); }

/* QUICK ACCESS */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.quick-item { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 16px 10px; text-align: center; cursor: pointer; transition: all 0.2s; }
.quick-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.quick-item.accent { background: var(--primary-light); border: 1px solid #c7d2fe; }
.quick-icon { font-size: 24px; margin-bottom: 6px; }
.quick-label { font-size: 12px; font-weight: 700; color: var(--text); }
.quick-sub { font-size: 10px; color: var(--text-3); margin-top: 2px; }

/* PROGRESS BARS */
.progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.progress-label { font-size: 13px; color: var(--text); font-weight: 500; min-width: 110px; }
.progress-bar { flex: 1; position: relative; background: var(--surface-2); border-radius: 4px; height: 10px; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.progress-meta { position: absolute; left: 90%; top: 0; width: 2px; height: 100%; background: var(--text); }
.progress-value { font-size: 12px; font-weight: 700; min-width: 40px; text-align: right; }

/* ANOTACIONES */
.anot-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--surface-2); }
.anot-fecha { font-size: 12px; color: var(--text-3); min-width: 75px; }
.anot-badge { font-size: 11px; padding: 3px 10px; border-radius: 8px; font-weight: 600; }
.anot-positiva { background: var(--success-light); color: var(--success); }
.anot-negativa { background: var(--danger-light); color: var(--danger); }
.anot-filter { padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.2s; }
.anot-filter.active { background: var(--primary); color: white; border-color: var(--primary); }

/* HISTORICO TOGGLE */
.hist-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.hist-toggle-btn { padding: 10px 20px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.2s; }
.hist-toggle-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* RESPONSIVE */
@media (max-width: 768px) {
  .stats-grid, .quick-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .profile-row { flex-direction: column; text-align: center; }
}
@media (max-width: 480px) {
  .quick-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* DARK MODE */
body.dark-mode { --bg: #0f1117; --surface: #1a1d27; --surface-2: #252830; --text: #e4e4e7; --text-2: #9ca3af; --text-3: #6b7280; --border: #2d3039; --primary-light: #1e2a4a; }
body.dark-mode .login-page { background: linear-gradient(135deg, #0a0c14 0%, #0f172a 50%, #1a2744 100%); }
body.dark-mode .app-header { background: #1a1d27; border-color: #2d3039; }
body.dark-mode .bottom-nav { background: #1a1d27; border-color: #2d3039; }
body.dark-mode .stat-card, body.dark-mode .card { background: #1a1d27; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
body.dark-mode .quick-item { background: #1a1d27; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
body.dark-mode .quick-item.accent { background: #1e2a4a; border-color: #2d4a7a; }
body.dark-mode .anot-filter { background: #1a1d27; border-color: #2d3039; color: #9ca3af; }
body.dark-mode .anot-filter.active { background: var(--primary); color: white; }
body.dark-mode .hist-toggle-btn { background: #1a1d27; border-color: #2d3039; color: #9ca3af; }
body.dark-mode .hist-toggle-btn.active { background: var(--primary); color: white; }
body.dark-mode .profile-card { box-shadow: 0 4px 20px rgba(0,0,0,0.4); }

/* THEME TOGGLE */
.theme-toggle { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.theme-toggle:hover { background: var(--primary-light); }
