:root {
  --azul: #1e3a8a;
  --azul-claro: #2563eb;
  --texto: #1f2937;
  --texto-muted: #6b7280;
  --borde: #e5e7eb;
  --fondo: #f8fafc;
  --verde: #16a34a;
  --rojo: #dc2626;
  --amarillo: #d97706;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  min-height: 100%;
}

a { color: var(--azul-claro); text-decoration: none; }
a:hover { text-decoration: underline; }

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--azul);
  color: white;
  flex-wrap: wrap;
  gap: 10px;
}
.navbar-brand a { color: white; font-weight: 700; font-size: 16px; }
.navbar-links { display: flex; gap: 16px; flex-wrap: wrap; }
.navbar-links a { color: #dbeafe; }
.navbar-user { display: flex; align-items: center; gap: 12px; }
.navbar-user-info { display: flex; flex-direction: column; text-align: right; font-size: 12px; }
.navbar-user-info span { color: #cbd5e1; }

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.section { margin-bottom: 32px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}
.section h2, .section h3, .page h1 { margin: 0 0 4px 0; }

.muted { color: var(--texto-muted); font-size: 14px; }

.table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--borde);
  border-radius: 8px;
  overflow: hidden;
}
.table th, .table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--borde);
  font-size: 14px;
  vertical-align: middle;
}
.table th { background: #f1f5f9; font-weight: 600; }
.table tr:last-child td { border-bottom: none; }

.btn {
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  display: inline-block;
}
.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--azul-claro); color: white; }
.btn-success { background: var(--verde); color: white; }
.btn-danger { background: var(--rojo); color: white; }
.btn-warning { background: var(--amarillo); color: white; }
.btn-ghost { background: transparent; color: white; border: 1px solid rgba(255,255,255,0.4); }
.btn-small { background: #e5e7eb; color: var(--texto); padding: 4px 10px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.inline-form { display: inline; }

.alert {
  padding: 10px 14px;
  border-radius: 6px;
  margin: 10px 0;
  font-size: 14px;
}
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #d1fae5; color: #065f46; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-super { background: #ede9fe; color: #5b21b6; }
.badge-admin { background: #dbeafe; color: #1e40af; }
.badge-revisor { background: #fef3c7; color: #92400e; }
.badge-ce { background: #d1fae5; color: #065f46; }
.badge-ei { background: #e0e7ff; color: #3730a3; }
.badge-activo { background: #d1fae5; color: #065f46; }
.badge-inactivo { background: #fee2e2; color: #991b1b; }
.badge-suspendido { background: #fef3c7; color: #92400e; }
.badge-baja { background: #e5e7eb; color: #374151; }

.login-wrap {
  min-height: calc(100vh - 40px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: white;
  border: 1px solid var(--borde);
  border-radius: 12px;
  padding: 32px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-card h1 { margin: 0; font-size: 20px; color: var(--azul); }

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--texto-muted);
  flex: 1;
}
input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--borde);
  border-radius: 6px;
  color: var(--texto);
  font-weight: 400;
}

.card-form {
  background: white;
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 640px;
}
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row label { min-width: 200px; }

.validation-summary-errors ul { color: var(--rojo); font-size: 13px; margin: 0; padding-left: 18px; }
.field-validation-error { color: var(--rojo); font-size: 12px; }
.input-validation-error { border-color: var(--rojo) !important; }

.back-link { display: inline-block; margin-bottom: 12px; font-size: 14px; }

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.menu-card {
  background: white;
  border: 1px solid var(--borde);
  border-radius: 10px;
  padding: 20px;
  display: block;
}
.menu-card h3 { margin: 0 0 6px 0; color: var(--azul); }
.menu-card p { margin: 0; font-size: 13px; color: var(--texto-muted); }
