/* Visor de trazabilidad de ECP. Todo va bajo .tecp para no chocar con el tema.
   Colores del ICUAM Design System (colors_and_type.css); el tema puede
   sobrescribir cualquier --tecp-* desde fuera. */

.tecp {
  --tecp-fuente: 'News Gothic Std', 'Liberation Sans', Arial, Helvetica, sans-serif;
  --tecp-mono: 'JetBrains Mono', Consolas, 'Courier New', monospace;
  --tecp-marca: #0064AC;
  --tecp-marca-oscura: #003F6E;
  --tecp-marca-suave: #EBF2F9;
  --tecp-texto: #1D1D1B;
  --tecp-texto-2: #4D4D4D;
  --tecp-tenue: #6B6B6B;
  --tecp-fondo: #FFFFFF;
  --tecp-fondo-2: #F8F8F8;
  --tecp-borde: #D9D9D9;
  --tecp-borde-suave: #E6E6E6;
  --tecp-uc-fondo: #F0F0F0;
  --tecp-uc-borde: #9A9A9A;
  --tecp-ecp-fondo: #F7F9EB;
  --tecp-ecp-borde: #7DA025;
  --tecp-foco-fondo: #EEF3D6;
  --tecp-ok: #2E7D5B;
  --tecp-ok-fondo: #E3F2EC;
  --tecp-deducida: #C77A0F;
  --tecp-deducida-fondo: #FDF1DC;
  --tecp-error: #B0392B;
  --tecp-error-fondo: #FBEAE8;
  --tecp-integracion: #A05C9E;
  --tecp-radio: 8px;

  font-family: var(--tecp-fuente);
  color: var(--tecp-texto);
  background: var(--tecp-fondo);
  font-size: 15px;
  line-height: 1.5;
  max-width: 1280px;
  margin: 0 auto;
  box-sizing: border-box;
}
.tecp *, .tecp *::before, .tecp *::after { box-sizing: inherit; }
.tecp h2, .tecp h3, .tecp h4, .tecp p, .tecp ul, .tecp ol, .tecp dl { margin: 0; padding: 0; }
.tecp ul, .tecp ol { list-style: none; }
.tecp a { color: var(--tecp-marca); text-decoration: underline; text-underline-offset: 2px; }
.tecp a:hover { color: #EE7E1F; }
.tecp button { font: inherit; cursor: pointer; }
.tecp :focus-visible { outline: 3px solid #EE7E1F; outline-offset: 2px; }
.tecp-oculto { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tecp-tenue { color: var(--tecp-tenue); }
.tecp small { font-size: 12.5px; }

/* Cabecera y buscador ------------------------------------------------------------ */

.tecp-cabecera {
  padding: 28px 28px 24px;
  border-radius: var(--tecp-radio);
  background: var(--tecp-marca-suave);
  position: relative;
  overflow: visible;
}
.tecp-cabecera::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px;
  border-radius: var(--tecp-radio) var(--tecp-radio) 0 0;
  background: linear-gradient(90deg, #EE7E1F 0%, #A05C9E 33%, #A4C32E 66%, #0064AC 100%);
}
.tecp-antetitulo { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--tecp-marca-oscura); font-weight: 700; }
.tecp-titulo { font-size: 28px; line-height: 1.15; margin: 6px 0 8px !important; color: var(--tecp-texto); font-weight: 700; }
.tecp-ayuda { max-width: 760px; color: var(--tecp-texto-2); margin-bottom: 16px !important; }
.tecp-buscador { position: relative; max-width: 760px; }
.tecp-buscador input {
  width: 100%; font: inherit; font-size: 17px; padding: 13px 16px 13px 44px;
  border: 2px solid var(--tecp-marca); border-radius: var(--tecp-radio); background: #fff;
  color: var(--tecp-texto);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%230064AC' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='8.5' cy='8.5' r='6'/%3E%3Cpath d='m13 13 5 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 14px center;
}
.tecp-sugerencias {
  position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 420px; overflow-y: auto; background: #fff; border: 1px solid var(--tecp-borde);
  border-radius: var(--tecp-radio); box-shadow: 0 10px 30px rgba(0, 0, 0, .14);
}
.tecp-sugerencias li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--tecp-borde-suave); }
.tecp-sugerencias li:last-child { border-bottom: 0; }
.tecp-sugerencias li[aria-selected="true"], .tecp-sugerencias li[role=option]:hover { background: var(--tecp-marca-suave); }
.tecp-sug-texto { display: flex; flex-direction: column; min-width: 0; }
.tecp-sug-texto small { color: var(--tecp-tenue); }
.tecp-vacio { color: var(--tecp-tenue); cursor: default !important; }
.tecp-sugerencias li.tecp-sug-grupo {
  position: sticky; top: 0; z-index: 1; cursor: default; padding: 6px 12px; background: var(--tecp-fondo-2);
  font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--tecp-marca-oscura);
}
.tecp-aviso-suave { margin-top: 10px !important; padding: 8px 12px; border-left: 4px solid var(--tecp-deducida); background: var(--tecp-deducida-fondo); font-size: 14px; }
.tecp-centros summary { cursor: pointer; color: var(--tecp-marca); font-weight: 700; }
.tecp-centros ul { margin-top: 6px !important; }
.tecp-centros li { font-size: 13.5px; padding: 1px 0; }

/* Insignias por tipo de elemento ----------------------------------------------------- */

.tecp-insignia {
  display: inline-block; flex: none; font-size: 11px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; padding: 3px 7px; border-radius: 4px; min-width: 76px; text-align: center;
  background: var(--tecp-uc-fondo); color: var(--tecp-texto-2);
}
.tecp-insignia--ecp { background: #E2EAB1; color: #455617; }
.tecp-insignia--certificado, .tecp-insignia--grado_c { background: #FCE6D3; color: #934814; }
.tecp-insignia--titulo_fp, .tecp-insignia--ensenanza, .tecp-insignia--curso_especializacion { background: #D6E5F3; color: #003F6E; }
.tecp-insignia--modulo, .tecp-insignia--modulo_ensenanza { background: #ECDDEB; color: #6B3F69; }

.tecp-marca {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px;
  background: var(--tecp-uc-fondo); color: var(--tecp-texto-2); white-space: nowrap;
}
.tecp-marca--ok { background: var(--tecp-ok-fondo); color: var(--tecp-ok); }
.tecp-marca--deducida { background: var(--tecp-deducida-fondo); color: #8A520A; }
.tecp-marca--error { background: var(--tecp-error-fondo); color: var(--tecp-error); }

.tecp-estado { min-height: 0; margin: 10px 0; color: var(--tecp-tenue); }
.tecp-estado:empty { margin: 0; }
.tecp-estado--error { color: var(--tecp-error); font-weight: 700; }
.tecp-nota { color: var(--tecp-tenue); margin-bottom: 12px !important; }
.tecp-alerta { color: var(--tecp-error); background: var(--tecp-error-fondo); padding: 8px 12px; border-radius: 6px; margin-top: 10px !important; }

/* Elemento elegido -------------------------------------------------------------------- */

.tecp-cuerpo { margin-top: 18px; }
.tecp-elemento { padding: 18px 22px; border: 1px solid var(--tecp-borde); border-radius: var(--tecp-radio); margin-bottom: 18px; }
.tecp-elemento h3 { font-size: 22px; line-height: 1.25; margin: 8px 0 4px !important; }
.tecp-meta { color: var(--tecp-tenue); }
.tecp-fuente { margin-top: 8px !important; font-size: 14px; color: var(--tecp-texto-2); }
.tecp-unidades { margin-top: 12px; }
.tecp-unidades summary { cursor: pointer; color: var(--tecp-marca); font-weight: 700; }
.tecp-unidades table, .tecp-tabla { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.tecp-unidades th, .tecp-unidades td, .tecp-tabla th, .tecp-tabla td {
  text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--tecp-borde-suave);
}
.tecp-unidades th, .tecp-tabla th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--tecp-tenue); background: var(--tecp-fondo-2); }

.tecp-rejilla { display: grid; grid-template-columns: minmax(230px, 290px) minmax(0, 1fr); gap: 18px; align-items: start; }

/* Lista de ECP ----------------------------------------------------------------------- */

.tecp-lista { border: 1px solid var(--tecp-borde); border-radius: var(--tecp-radio); overflow: hidden; position: sticky; top: 16px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.tecp-lista-cab { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; background: var(--tecp-fondo-2); border-bottom: 1px solid var(--tecp-borde); }
.tecp-lista-cab h4 { font-size: 15px; }
.tecp-lista ul { overflow-y: auto; }
.tecp-lista li button {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; background: #fff; color: var(--tecp-texto);
  border: 0; border-bottom: 1px solid var(--tecp-borde-suave); border-left: 4px solid transparent; padding: 10px 12px;
}
.tecp-lista li button:hover { background: var(--tecp-marca-suave); }
.tecp-lista li button[aria-current="true"] { border-left-color: var(--tecp-marca); background: var(--tecp-marca-suave); }
.tecp-lista li strong { font-family: var(--tecp-mono); font-size: 13px; color: var(--tecp-marca-oscura); }
.tecp-lista li span { font-size: 14px; line-height: 1.35; }
.tecp-lista li small { color: var(--tecp-tenue); }
.tecp-lista li small.tecp-marca { align-self: flex-start; margin-top: 3px; }
.tecp-boton { border: 1px solid var(--tecp-marca); color: var(--tecp-marca); background: #fff; padding: 5px 10px; border-radius: 6px; font-size: 13px; font-weight: 700; }
.tecp-boton:hover { background: var(--tecp-marca); color: #fff; }

/* Detalle de un ECP -------------------------------------------------------------------- */

.tecp-detalle { min-width: 0; border: 1px solid var(--tecp-borde); border-radius: var(--tecp-radio); padding: 18px 22px; }
.tecp-ecp { margin-bottom: 14px; }
.tecp-ecp h3 { font-size: 21px; line-height: 1.25; margin: 4px 0 8px !important; }
.tecp-codigo { font-family: var(--tecp-mono); font-size: 13px; color: var(--tecp-marca-oscura); }
.tecp-ecp p:last-child { display: flex; flex-wrap: wrap; gap: 6px; }
.tecp-pestanas { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 2px solid var(--tecp-borde); margin-bottom: 16px; }
.tecp-pestanas button {
  background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; padding: 9px 14px;
  color: var(--tecp-texto-2); font-weight: 700;
}
.tecp-pestanas button[aria-selected="true"] { color: var(--tecp-marca); border-bottom-color: var(--tecp-marca); }
.tecp-pestanas button:hover { color: var(--tecp-marca); }

/* Diagrama de la evolución (SVG, al estilo del informe en Word) */
.tecp-lienzo { overflow-x: auto; border: 1px solid var(--tecp-borde-suave); border-radius: 6px; background: #fff; padding: 6px; }
.tecp-svg { display: block; margin: 0 auto; max-width: none; height: auto; font-family: var(--tecp-fuente); }
.tecp-s-col { font-size: 18px; font-weight: 700; fill: #1F2937; }
.tecp-s-colraya { stroke: #E2E8F0; stroke-width: 3; }
.tecp-s-nodo rect { fill: #F1F5F9; stroke: #94A3B8; stroke-width: 2; }
.tecp-s-nodo.tecp-s-baja rect { fill: #FEF2F2; stroke: #DC7878; }
.tecp-s-nodo.tecp-s-ecp rect { fill: #ECFDF5; stroke: #10966E; }
.tecp-s-nodo.tecp-s-foco rect { fill: #D1FAE5; stroke: #047857; stroke-width: 4; }
.tecp-s-nodo.tecp-s-lateral { opacity: .82; }
.tecp-s-nodo.tecp-s-enlace { cursor: pointer; }
.tecp-s-nodo.tecp-s-enlace:hover rect, .tecp-s-nodo:focus rect { stroke: var(--tecp-marca); }
.tecp-s-nodo:focus { outline: none; }
.tecp-s-cod { font-size: 21px; font-weight: 700; fill: #1F2937; }
.tecp-s-den { font-size: 15.5px; fill: #64748B; }
.tecp-s-pie { font-size: 15px; fill: #64748B; }
.tecp-s-arista { cursor: pointer; }
.tecp-s-arista:focus { outline: none; }
.tecp-s-toque { fill: none; stroke: transparent; stroke-width: 14; }
.tecp-s-linea { fill: none; stroke-width: 3; }
.tecp-s-escision { stroke: #B45309; }
.tecp-s-integracion { stroke: #2563EB; }
.tecp-s-deducida { stroke: #B45309; stroke-dasharray: 7 6; opacity: .75; }
.tecp-s-puente { stroke-dasharray: 9 7; }
.tecp-s-arista:hover .tecp-s-linea, .tecp-s-arista:focus .tecp-s-linea { stroke-width: 4.5; }
.tecp-f-escision, .tecp-f-deducida { fill: #B45309; }
.tecp-f-integracion { fill: #2563EB; }
.tecp-s-etq { font-size: 14.5px; }
.tecp-s-etq-tipo { font-weight: 700; font-size: 15.5px; }
.tecp-s-etq-escision, .tecp-s-etq-deducida { fill: #B45309; }
.tecp-s-etq-integracion { fill: #2563EB; }

.tecp-leyenda { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 !important; font-size: 13px; color: var(--tecp-texto-2); }
.tecp-leyenda li { display: flex; align-items: center; gap: 6px; }
.tecp-leyenda i { width: 18px; height: 12px; border-radius: 3px; border: 2px solid; display: inline-block; }
.tecp-leyenda b { width: 26px; height: 0; border-top: 3px solid; display: inline-block; }
.tecp-leyenda .tecp-l-uc { background: #F1F5F9; border-color: #94A3B8; }
.tecp-leyenda .tecp-l-baja { background: #FEF2F2; border-color: #DC7878; }
.tecp-leyenda .tecp-l-ecp { background: #ECFDF5; border-color: #10966E; }
.tecp-leyenda .tecp-l-foco { background: #D1FAE5; border-color: #047857; border-width: 3px; }
.tecp-leyenda .tecp-l-esc { border-color: #B45309; }
.tecp-leyenda .tecp-l-int { border-color: #2563EB; }
.tecp-leyenda .tecp-l-ded { border-color: #B45309; border-top-style: dashed; }
.tecp-paso { background: var(--tecp-fondo-2); border-radius: 6px; padding: 12px 16px; }
.tecp-paso h4 { font-family: var(--tecp-mono); font-size: 14px; margin-bottom: 8px !important; }
.tecp-paso li { padding: 8px 0; border-top: 1px solid var(--tecp-borde-suave); }
.tecp-paso li:first-child { border-top: 0; }
.tecp-paso .tecp-nota { margin: 0 !important; }

.tecp-cronologia > li { display: grid; grid-template-columns: 64px 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--tecp-borde-suave); }
.tecp-cronologia > li:first-child { border-top: 0; }
.tecp-anio { font-weight: 700; font-size: 20px; color: var(--tecp-marca); }
.tecp-norma { font-weight: 700; }
.tecp-cronologia ul { margin-top: 6px !important; }
.tecp-cronologia ul li { position: relative; padding-left: 16px; font-size: 14px; }
.tecp-cronologia ul li::before { content: ''; position: absolute; left: 2px; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: var(--tecp-marca); }
.tecp-cronologia ul li.tecp-deducida::before { background: var(--tecp-deducida); }

.tecp-grupo { font-size: 16px; margin: 18px 0 8px !important; color: var(--tecp-marca-oscura); }
.tecp-grupo:first-of-type { margin-top: 4px !important; }
.tecp-citas li { padding: 8px 0; border-top: 1px solid var(--tecp-borde-suave); }
.tecp-citas li p.tecp-tenue { font-size: 13.5px; }
.tecp-ficha { display: grid; grid-template-columns: 170px 1fr; gap: 6px 16px; }
.tecp-ficha dt { font-weight: 700; color: var(--tecp-texto-2); }
.tecp-ficha dd { margin: 0; }

.tecp-pie { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--tecp-borde); font-size: 13px; color: var(--tecp-tenue); }
.tecp-aviso { padding: 12px; background: #FDF1DC; border-left: 4px solid #C77A0F; }

@media (max-width: 860px) {
  .tecp-rejilla { grid-template-columns: 1fr; }
  .tecp-lista { position: static; max-height: 340px; }
  .tecp-cabecera { padding: 22px 16px 18px; }
  .tecp-titulo { font-size: 23px; }
  .tecp-detalle, .tecp-elemento { padding: 14px; }
  .tecp-ficha { grid-template-columns: 1fr; }
}
