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

:root {
  --azul:       #1E72B8;
  --azul-dark:  #155a93;
  --azul-light: #e8f2fb;
  --verde:      #6ABF3A;
  --verde-dark: #4e9628;
  --verde-light:#eaf5e0;
  --gris-bg:    #f4f6f9;
  --gris-card:  #ffffff;
  --gris-texto: #3a3a3a;
  --gris-muted: #7a8a99;
  --gris-borde: #e0e6ed;
  --rojo:       #EA4335;
  --amarillo:   #FBBC04;
  --shadow-sm:  0 1px 4px rgba(30,114,184,0.08);
  --shadow-md:  0 4px 16px rgba(30,114,184,0.12);
  --shadow-lg:  0 8px 32px rgba(30,114,184,0.16);
  --radius:     10px;
  --radius-lg:  16px;
}

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

body {
  font-family: 'Nunito', sans-serif;
  background: var(--gris-bg);
  color: var(--gris-texto);
  font-size: 14px;
  line-height: 1.6;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--azul-dark);
  background-image: linear-gradient(180deg, #1E72B8 0%, #155a93 60%, #0e3d66 100%);
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  text-align: center;
}

.sidebar-logo img {
  width: 160px;
  filter: none;
  background: white;
  border-radius: 1px;
  padding: 4px;
}

.sidebar-logo .tagline {
  font-size: 10px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 6px;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.nav-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  padding: 16px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-left-color: rgba(255,255,255,0.3);
}

.nav-item.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-left-color: var(--verde);
}

.nav-item i { font-size: 17px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  color: rgba(255,255,255,0.45);
}

.sidebar-footer strong { color: rgba(255,255,255,0.75); display: block; font-size: 13px; }

/* ── MAIN LAYOUT ── */
.main-wrap {
  margin-left: 240px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--gris-borde);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--azul);
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-title i { color: var(--verde); font-size: 18px; }

.topbar-right { display: flex; align-items: center; gap: 14px; }

.btn-logout {
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--gris-borde);
  background: #fff;
  color: var(--gris-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-logout:hover { background: var(--gris-bg); color: var(--rojo); border-color: var(--rojo); }

.page-content { padding: 28px; flex: 1; }

/* ── CARDS ── */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gris-borde);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--gris-borde);
}

.card-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--azul);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title i { color: var(--verde); }

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gris-borde);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}

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

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--azul);
}

.stat-card.verde::before { background: var(--verde); }
.stat-card.rojo::before  { background: var(--rojo); }
.stat-card.amarillo::before { background: var(--amarillo); }

.stat-num {
  font-family: 'Montserrat', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--azul);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--gris-muted);
  margin-top: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 32px;
  color: var(--azul-light);
}

/* ── BOTONES ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--azul);
  color: #fff;
}
.btn-primary:hover { background: var(--azul-dark); box-shadow: var(--shadow-md); }

.btn-success {
  background: var(--verde);
  color: #fff;
}
.btn-success:hover { background: var(--verde-dark); box-shadow: var(--shadow-md); }

.btn-outline {
  background: transparent;
  color: var(--azul);
  border: 1.5px solid var(--azul);
}
.btn-outline:hover { background: var(--azul-light); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-danger { background: var(--rojo); color: #fff; }
.btn-danger:hover { background: #c0392b; }

/* ── TABLA ── */
.table-wrap { overflow-x: auto; }

table.iaf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.iaf-table thead th {
  background: var(--azul);
  color: #fff;
  padding: 11px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.iaf-table thead th:first-child { border-radius: 8px 0 0 0; }
.iaf-table thead th:last-child  { border-radius: 0 8px 0 0; }

.iaf-table tbody tr {
  border-bottom: 1px solid var(--gris-borde);
  transition: background 0.15s;
}

.iaf-table tbody tr:hover { background: var(--azul-light); }

.iaf-table tbody td {
  padding: 11px 14px;
  color: var(--gris-texto);
  vertical-align: middle;
}

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.badge-verde    { background: var(--verde-light); color: var(--verde-dark); }
.badge-azul     { background: var(--azul-light);  color: var(--azul-dark); }
.badge-rojo     { background: #fde8e6; color: #b03020; }
.badge-amarillo { background: #fef8e1; color: #8a6500; }
.badge-gris     { background: #f0f0f0; color: #666; }

/* ── FORMULARIOS ── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--gris-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gris-borde);
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 13.5px;
  color: var(--gris-texto);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(30,114,184,0.12);
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── WIZARD STEPS ── */
.wizard-steps {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
  padding: 20px 24px;
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gris-borde);
  box-shadow: var(--shadow-sm);
  gap: 0;
}

.w-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  position: relative;
}

.w-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--gris-borde);
  z-index: 0;
}

.w-step.done:not(:last-child)::after { background: var(--verde); }
.w-step.active:not(:last-child)::after { background: var(--gris-borde); }

.w-step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  border: 2px solid var(--gris-borde);
  background: #fff;
  color: var(--gris-muted);
  position: relative;
  z-index: 1;
  transition: all 0.3s;
}

.w-step.done .w-step-num {
  background: var(--verde);
  border-color: var(--verde);
  color: #fff;
}

.w-step.active .w-step-num {
  background: var(--azul);
  border-color: var(--azul);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(30,114,184,0.15);
}

.w-step-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gris-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.w-step.active .w-step-label { color: var(--azul); }
.w-step.done .w-step-label   { color: var(--verde-dark); }

/* ── CALIFICACIONES ── */
.ficha-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gris-borde);
  margin-bottom: 16px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.ficha-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--azul);
  color: #fff;
  cursor: pointer;
  user-select: none;
}

.ficha-header:hover { background: var(--azul-dark); }

.ficha-titulo {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ficha-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.ficha-score {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.score-pill {
  padding: 3px 12px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 13px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  min-width: 44px;
  text-align: center;
}

.ficha-body { display: none; padding: 0 20px 16px; }
.ficha-card.open .ficha-body { display: block; }

.item-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gris-borde);
}

.item-row:last-child { border-bottom: none; }

.item-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--azul-light);
  color: var(--azul);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.item-desc {
  flex: 1;
  font-size: 12.5px;
  color: var(--gris-texto);
  line-height: 1.5;
}

.calif-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.calif-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.calif-btn[data-val="1"] { border-color: #f8d7da; color: var(--rojo); }
.calif-btn[data-val="3"] { border-color: #fff3cd; color: #b8860b; }
.calif-btn[data-val="5"] { border-color: #d4edda; color: var(--verde-dark); }

.calif-btn[data-val="1"].selected { background: var(--rojo);       color: #fff; border-color: var(--rojo); }
.calif-btn[data-val="3"].selected { background: var(--amarillo);   color: #fff; border-color: var(--amarillo); }
.calif-btn[data-val="5"].selected { background: var(--verde);      color: #fff; border-color: var(--verde); }

.calif-btn:hover { transform: scale(1.1); }

/* ── ALERTS ── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-success { background: var(--verde-light); color: var(--verde-dark); border: 1px solid #b8dfa0; }
.alert-error   { background: #fde8e6; color: #b03020; border: 1px solid #f5c6c2; }
.alert-info    { background: var(--azul-light); color: var(--azul-dark); border: 1px solid #b5d4f4; }

/* ── FOTO UPLOAD ── */
.foto-zone {
  border: 2px dashed var(--gris-borde);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--gris-bg);
}

.foto-zone:hover, .foto-zone.dragover {
  border-color: var(--azul);
  background: var(--azul-light);
}

.foto-zone i { font-size: 32px; color: var(--gris-muted); margin-bottom: 8px; }
.foto-zone p { font-size: 13px; color: var(--gris-muted); }

.foto-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.foto-preview {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 4/3;
  border: 1px solid var(--gris-borde);
}

.foto-preview img { width: 100%; height: 100%; object-fit: cover; }

.foto-del {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(234,67,53,0.85);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

/* ── LOGIN ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, #0e3d66 0%, #1E72B8 50%, #2d8a4e 100%);
}

.login-left {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-box {
  background: #fff;
  border-radius: 20px;
  padding: 40px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { width: 160px; 
background: white;}

.login-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--azul);
  text-align: center;
  margin-bottom: 6px;
}

.login-sub {
  font-size: 13px;
  color: var(--gris-muted);
  text-align: center;
  margin-bottom: 28px;
}

.login-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  flex-direction: column;
  gap: 20px;
}

.login-brand {
  font-family: 'Montserrat', sans-serif;
  color: rgba(255,255,255,0.9);
  text-align: center;
}

.login-brand h1 {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
}

.login-brand h1 span { color: #6ABF3A; }

.login-brand p {
  font-size: 15px;
  color: rgba(255,255,255,0.65);
  max-width: 380px;
  line-height: 1.7;
}

.login-features {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 360px;
  width: 100%;
}

.login-feat {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 14px 18px;
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.12);
}

.login-feat i { font-size: 20px; color: #6ABF3A; flex-shrink: 0; }

/* ── UTILS ── */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-0  { margin-bottom: 0; }
.mb-12 { margin-bottom: 12px; }
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }
.text-muted { color: var(--gris-muted); }
.text-center { text-align: center; }
.w-100 { width: 100%; }

@media (max-width: 900px) {
  .sidebar { width: 200px; }
  .main-wrap { margin-left: 200px; }
  .login-right { display: none; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}
