:root {
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a8a;
  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --amber-500: #f59e0b;
  --red-500: #ef4444;
  --white: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--slate-50);
  color: var(--slate-800);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Login */
.login-container {
  display: flex;
  min-height: 100vh;
}

.login-left {
  flex: 1;
  background: linear-gradient(135deg, var(--blue-800) 0%, var(--blue-600) 50%, var(--indigo-600) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  position: relative;
  overflow: hidden;
}

.login-left::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -10%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}

.login-left::after {
  content: '';
  position: absolute;
  bottom: -15%;
  left: -5%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
}

.login-branding {
  position: relative;
  z-index: 1;
  color: white;
  max-width: 420px;
}

.logo-icon {
  width: 72px;
  height: 72px;
  margin-bottom: 1.5rem;
}

.login-branding h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.login-subtitle {
  font-size: 1.1rem;
  font-weight: 500;
  opacity: 0.9;
  margin-bottom: 1.5rem;
}

.login-desc {
  font-size: 0.95rem;
  opacity: 0.7;
  line-height: 1.6;
}

.login-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background: var(--white);
}

.login-form {
  width: 100%;
  max-width: 400px;
}

.login-form h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 0.25rem;
}

.form-subtitle {
  color: var(--slate-500);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--slate-700);
  margin-bottom: 0.5rem;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--slate-800);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.form-group input::placeholder { color: var(--slate-400); }

.error-msg {
  background: #fef2f2;
  color: var(--red-500);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  border: 1px solid #fecaca;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--blue-600);
  color: white;
}
.btn-primary:hover { background: var(--blue-700); }

.btn-ghost {
  background: transparent;
  color: var(--slate-600);
}
.btn-ghost:hover { background: var(--slate-100); }

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.btn-full { width: 100%; justify-content: center; padding: 0.85rem; }

.btn-danger { background: var(--red-500); color: white; }
.btn-danger:hover { opacity: 0.9; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--blue-300);
  color: var(--blue-600);
}
.btn-outline:hover { background: var(--blue-50); }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 60px;
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-logo { display: flex; }

.topbar-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--blue-700);
  letter-spacing: -0.01em;
}

.nav-tabs {
  display: flex;
  gap: 0.25rem;
  margin-left: 1.5rem;
}

.nav-tab {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--slate-500);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.nav-tab:hover { color: var(--slate-700); background: var(--slate-100); }
.nav-tab.active { color: var(--blue-700); background: var(--blue-50); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-badge {
  font-size: 0.85rem;
  color: var(--slate-600);
  font-weight: 500;
}

/* Main Content */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--slate-900);
}

.page-header p {
  color: var(--slate-500);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--slate-100);
  transition: transform 0.15s, box-shadow 0.15s;
}

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

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-blue .stat-icon { background: var(--blue-100); color: var(--blue-600); }
.stat-indigo .stat-icon { background: #e0e7ff; color: var(--indigo-600); }
.stat-green .stat-icon { background: #dcfce7; color: var(--green-600); }
.stat-amber .stat-icon { background: #fef3c7; color: #d97706; }

.stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--slate-900);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--slate-500);
  font-weight: 500;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--slate-100);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--slate-800);
  margin-bottom: 1.25rem;
}

/* Status List */
.status-list { display: flex; flex-direction: column; gap: 0.75rem; }

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--slate-50);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.75rem;
}

.status-name { font-size: 0.9rem; font-weight: 500; color: var(--slate-700); }
.status-count { font-size: 0.95rem; font-weight: 700; color: var(--slate-800); }

/* Bar Chart */
.bar-chart { display: flex; flex-direction: column; gap: 0.6rem; }

.bar-item { display: flex; align-items: center; gap: 0.75rem; }

.bar-label {
  width: 120px;
  font-size: 0.8rem;
  color: var(--slate-600);
  text-align: right;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  flex: 1;
  height: 24px;
  background: var(--slate-100);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-400), var(--blue-600));
  border-radius: 6px;
  transition: width 0.5s ease;
  min-width: 2px;
}

.bar-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-700);
  width: 40px;
}

/* Search */
.search-bar { margin-bottom: 1.5rem; }

.search-input {
  width: 100%;
  max-width: 400px;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.filter-bar {
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
}

.filter-select {
  padding: 0.6rem 1rem;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--white);
  color: var(--slate-700);
  cursor: pointer;
}

/* Table */
.table-container {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--slate-100);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 0.85rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
}

.data-table td {
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--slate-100);
  color: var(--slate-700);
}

.data-table tbody tr:hover { background: var(--blue-50); }

.data-table tbody tr:last-child td { border-bottom: none; }

/* Badge */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-blue { background: var(--blue-100); color: var(--blue-700); }
.badge-green { background: #dcfce7; color: var(--green-600); }
.badge-amber { background: #fef3c7; color: #d97706; }
.badge-red { background: #fef2f2; color: var(--red-500); }
.badge-slate { background: var(--slate-100); color: var(--slate-600); }

/* Projects Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.project-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--slate-100);
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

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

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.project-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--slate-800);
}

.project-meta {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--slate-500);
  margin-bottom: 1rem;
}

.project-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--slate-100);
}

.project-amount {
  font-weight: 700;
  color: var(--blue-700);
}

.project-beneficiarios {
  font-size: 0.8rem;
  color: var(--slate-500);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--slate-400);
  font-size: 0.95rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--slate-100);
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--slate-100);
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-500);
}
.modal-close:hover { background: var(--slate-200); }

.modal-body { padding: 1.5rem; }

.modal-body .form-group { margin-bottom: 1rem; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--slate-100);
  margin-top: 1rem;
}

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

/* Responsive */
@media (max-width: 768px) {
  .login-container { flex-direction: column; }
  .login-left { padding: 2rem; min-height: auto; }
  .login-right { padding: 2rem; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .nav-tabs { display: none; }
  .topbar { padding: 0 1rem; }
  .main-content { padding: 1.5rem 1rem; }
  .page-header { flex-direction: column; gap: 1rem; }
  .projects-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 0.6rem 0.5rem; }
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.main-content { animation: fadeIn 0.3s ease; }
.stat-card { animation: fadeIn 0.3s ease backwards; }
.stat-card:nth-child(2) { animation-delay: 0.05s; }
.stat-card:nth-child(3) { animation-delay: 0.1s; }
.stat-card:nth-child(4) { animation-delay: 0.15s; }
