/* ── Base ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #F4F4F2;
  color: #1C1C1C;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.header {
  background: #163824;
  color: #fff;
  padding: 1.1rem 1.5rem;
  border-bottom: 3px solid #2E7D52;
}
.header-inner {
  max-width: 680px;
  margin: 0 auto;
}
.header h1 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.header p {
  font-size: 0.78rem;
  color: #90B89F;
  margin-top: 0.15rem;
}

/* ── Container ──────────────────────────────────────────────────────────────── */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* ── Card ────────────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid #E0E0DB;
  border-radius: 6px;
  padding: 1.75rem;
  margin-bottom: 1rem;
}
.card.center { text-align: center; }

/* ── Tipografía utilitaria ───────────────────────────────────────────────────── */
.card-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #888880;
  margin-bottom: 1rem;
}
.hint {
  color: #777770;
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}
.muted {
  color: #888880;
  font-size: 0.88rem;
}

/* ── Utilities ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Spinner ─────────────────────────────────────────────────────────────────── */
.spinner {
  width: 28px; height: 28px;
  border: 3px solid #E0E0DB;
  border-top-color: #1B7A3E;
  border-radius: 50%;
  margin: 1rem auto 0.75rem;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Campos ──────────────────────────────────────────────────────────────────── */
.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #888880;
  margin-bottom: 0.4rem;
}
select,
input[type="password"] {
  width: 100%;
  padding: 0.7rem 0.875rem;
  border: 1px solid #D0D0CB;
  border-radius: 4px;
  font-size: 0.95rem;
  background: #fff;
  color: #1C1C1C;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .15s;
}
select:focus,
input:focus {
  outline: none;
  border-color: #1B7A3E;
  box-shadow: 0 0 0 3px rgba(27,122,62,.1);
}

/* ── Botones ─────────────────────────────────────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 0.8rem 1rem;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.75rem;
  transition: background .15s;
  letter-spacing: 0.01em;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: #1B7A3E; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #155F30; }

.btn-secondary {
  background: #fff;
  color: #1C1C1C;
  border: 1px solid #D0D0CB;
}
.btn-secondary:hover:not(:disabled) { background: #F4F4F2; }

/* ── Selección de ficha ──────────────────────────────────────────────────────── */
.ficha-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.ficha-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 1.1rem 1.25rem;
  background: #fff;
  border: 1px solid #D0D0CB;
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s;
  gap: 1rem;
}
.ficha-option:hover {
  border-color: #1B7A3E;
  background: #F0F7F3;
}
.ficha-option-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1C1C1C;
}
.ficha-option-count {
  font-size: 0.78rem;
  color: #888880;
  white-space: nowrap;
}

/* ── Barra de meta del proyecto ──────────────────────────────────────────────── */
.eval-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
}
.eval-ficha {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #1B7A3E;
}
.eval-progress {
  font-size: 0.78rem;
  color: #888880;
}

/* ── Encabezado del proyecto ─────────────────────────────────────────────────── */
.eval-project-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1C1C1C;
  margin-bottom: 0.3rem;
}
.eval-team {
  font-size: 0.8rem;
  color: #777770;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* ── Enlace documentación ────────────────────────────────────────────────────── */
.doc-link {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1B7A3E;
  text-decoration: none;
  border: 1px solid #C6DDD0;
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  margin-bottom: 1.5rem;
  transition: background .15s;
}
.doc-link:hover { background: #F0F7F3; }

/* ── Lista de criterios ──────────────────────────────────────────────────────── */
.criterios-list {
  border-top: 1px solid #EEEEE9;
}
.criterio-item {
  padding: 1.1rem 0;
  border-bottom: 1px solid #EEEEE9;
}

/* Nombre + input en la misma fila */
.criterio-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.criterio-nombre {
  font-weight: 600;
  font-size: 0.92rem;
  color: #1C1C1C;
  line-height: 1.35;
  flex: 1;
}

/* Input numérico limpio */
.score-input {
  width: 68px;
  height: 48px;
  padding: 0;
  border: 1px solid #D0D0CB;
  border-radius: 4px;
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  color: #1C1C1C;
  background: #fff;
  flex-shrink: 0;
  transition: border-color .15s;
  -moz-appearance: textfield;
}
.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.score-input:focus {
  outline: none;
  border-color: #1B7A3E;
  box-shadow: 0 0 0 3px rgba(27,122,62,.1);
}

/* Subcriterios como guía */
.subcriterios {
  list-style: none;
  padding-left: 0.75rem;
  border-left: 2px solid #D4E8DC;
}
.subcriterios li {
  font-size: 0.79rem;
  color: #777770;
  padding: 0.1rem 0;
}

/* ── Total ───────────────────────────────────────────────────────────────────── */
.total-section {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 1rem 0 0.25rem;
  margin-top: 0.25rem;
}
.total-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #888880;
  flex: 1;
}
.total-number {
  font-size: 2rem;
  font-weight: 800;
  color: #163824;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.total-denom {
  font-size: 0.9rem;
  color: #888880;
}

/* ── Mensajes ────────────────────────────────────────────────────────────────── */
.error-msg {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
  border-radius: 4px;
  padding: 0.65rem 0.875rem;
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* ── Página de resultados ────────────────────────────────────────────────────── */
.action-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.action-bar .btn {
  width: auto;
  padding: 0.6rem 1.1rem;
  margin-top: 0;
  font-size: 0.85rem;
}

.ficha-titulo {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #1B7A3E;
  margin: 1.75rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #C6DDD0;
}
.ficha-titulo:first-of-type { margin-top: 0; }

.table-wrap { overflow-x: auto; margin-bottom: 0.5rem; }

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.results-table th,
.results-table td {
  padding: 0.55rem 0.875rem;
  text-align: center;
  border: 1px solid #E0E0DB;
}
.results-table thead th {
  background: #163824;
  color: #fff;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.results-table thead .th-promedio { background: #0F2B1A; }
.results-table tbody tr:nth-child(even) { background: #FAFAF8; }

.col-proyecto { text-align: left; font-weight: 600; color: #1C1C1C; }
.col-nota { font-variant-numeric: tabular-nums; }
.col-total { font-weight: 700; }
.col-promedio { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Sección de detalle por criterio ────────────────────────────────────────── */
.detalle-section {
  margin-top: 1.5rem;
  margin-bottom: 2rem;
  padding-top: 1rem;
  border-top: 1px dashed #D0D0CB;
}
.detalle-section-titulo {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #888880;
  margin-bottom: 1rem;
}
.detalle-proyecto-nombre {
  font-size: 0.82rem;
  font-weight: 600;
  color: #444440;
  margin: 1rem 0 0.35rem;
}
.detalle-table {
  font-size: 0.8rem;
}
.detalle-table thead th {
  font-size: 0.72rem;
  background: #3A5C47;
}
.col-criterio-nombre {
  font-weight: 400;
  color: #444440;
}
.detalle-total-row td {
  font-weight: 700;
  background: #F0F4F2;
  border-top: 2px solid #C6DDD0;
}

.pendiente { color: #B0B0A8; }
.nota-buena { color: #14532D; }
.nota-media { color: #92400E; }
.nota-baja  { color: #991B1B; }

.print-date { font-size: 0.75rem; color: #999; margin-bottom: 1rem; }

.legend {
  font-size: 0.75rem;
  color: #777770;
  margin-top: 1rem;
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.25rem;
  vertical-align: middle;
}
.dot-buena { background: #14532D; }
.dot-media { background: #92400E; }
.dot-baja  { background: #991B1B; }

/* ── Impresión ───────────────────────────────────────────────────────────────── */
@media print {
  body { background: white; font-size: 10pt; }
  .no-print { display: none !important; }
  .header {
    background: #163824 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .container { max-width: 100%; padding: 0.5rem; }
  .card { border: none; padding: 0; }
  .results-table thead th {
    background: #163824 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .table-wrap { overflow: visible; }
  .legend { display: none; }
}
